From ab032699ac3bcb94877fac8e8b98cae4a5c5af7c Mon Sep 17 00:00:00 2001 From: Naramsim Date: Fri, 20 Dec 2024 12:52:21 +0100 Subject: [PATCH 01/13] deps: upgrade patches requirements.txt --- requirements.txt | 8 ++++---- test-requirements.txt | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/requirements.txt b/requirements.txt index 383b8bbd5..2da7d57ed 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,14 +1,14 @@ -Django==3.2.23 +Django==3.2.25 Unipath==1.1 coverage==4.5.4 django-cors-headers==3.14.0 django-discover-runner==1.0 django-redis==4.12.1 -django-cachalot==2.4.2 +django-cachalot==2.4.5 djangorestframework==3.14.0 -gunicorn==21.2.0 +gunicorn==23.0.0 mimeparse==0.1.3 -psycopg2-binary==2.9.9 +psycopg2-binary==2.9.10 python-dateutil==2.8.2 python-mimeparse==1.6.0 drf-spectacular==0.27.2 diff --git a/test-requirements.txt b/test-requirements.txt index 6ebf43ee1..f38274083 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,5 +1,5 @@ -r requirements.txt -pylint===2.8.2 +pylint===2.8.3 pylint-django===2.4.4 -astroid==2.5.6 -black==23.11.0 +astroid==2.5.8 +black==23.12.1 From f7dfa933174363b3ddb017c255fce9824da33371 Mon Sep 17 00:00:00 2001 From: Naramsim Date: Fri, 20 Dec 2024 13:02:19 +0100 Subject: [PATCH 02/13] deps: remove non-used deps --- test-requirements.txt | 3 --- 1 file changed, 3 deletions(-) diff --git a/test-requirements.txt b/test-requirements.txt index f38274083..e4cfea180 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,5 +1,2 @@ -r requirements.txt -pylint===2.8.3 -pylint-django===2.4.4 -astroid==2.5.8 black==23.12.1 From cedc36f6fd7ebcf8153f5943daf2e71b06eefa19 Mon Sep 17 00:00:00 2001 From: Naramsim Date: Fri, 20 Dec 2024 13:19:41 +0100 Subject: [PATCH 03/13] deps: fix python --- Resources/docker/app/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Resources/docker/app/Dockerfile b/Resources/docker/app/Dockerfile index a8d2ac4da..5d8070c35 100644 --- a/Resources/docker/app/Dockerfile +++ b/Resources/docker/app/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.10-alpine +FROM python:3.10.14-alpine ENV PYTHONUNBUFFERED 1 ENV DJANGO_SETTINGS_MODULE 'config.docker-compose' From cc946a687d991ce4dfe2ebe076d74652a35cbd7e Mon Sep 17 00:00:00 2001 From: Naramsim Date: Fri, 20 Dec 2024 13:21:27 +0100 Subject: [PATCH 04/13] deps: update python --- Resources/docker/app/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Resources/docker/app/Dockerfile b/Resources/docker/app/Dockerfile index 5d8070c35..744ea43b3 100644 --- a/Resources/docker/app/Dockerfile +++ b/Resources/docker/app/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.10.14-alpine +FROM python:3.13.1-alpine3.21 ENV PYTHONUNBUFFERED 1 ENV DJANGO_SETTINGS_MODULE 'config.docker-compose' From db5f45b3e7b34ac7b1b3804f21566f6866bdc0a8 Mon Sep 17 00:00:00 2001 From: Naramsim Date: Fri, 20 Dec 2024 13:54:18 +0100 Subject: [PATCH 05/13] deps: downgrade python --- Resources/docker/app/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Resources/docker/app/Dockerfile b/Resources/docker/app/Dockerfile index 744ea43b3..6923ca245 100644 --- a/Resources/docker/app/Dockerfile +++ b/Resources/docker/app/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.13.1-alpine3.21 +FROM python:3.12.8-alpine3.21 ENV PYTHONUNBUFFERED 1 ENV DJANGO_SETTINGS_MODULE 'config.docker-compose' From 7497b24b7b50cc7c424198aa2797ae3c790ed916 Mon Sep 17 00:00:00 2001 From: Naramsim Date: Fri, 20 Dec 2024 18:09:33 +0100 Subject: [PATCH 06/13] deps: downgrade python --- Resources/docker/app/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Resources/docker/app/Dockerfile b/Resources/docker/app/Dockerfile index 6923ca245..0e1ad02ac 100644 --- a/Resources/docker/app/Dockerfile +++ b/Resources/docker/app/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.12.8-alpine3.21 +FROM python:3.11.11-alpine3.21 ENV PYTHONUNBUFFERED 1 ENV DJANGO_SETTINGS_MODULE 'config.docker-compose' From 3711c8bd8532e698272e078cba928ee7e2f949e1 Mon Sep 17 00:00:00 2001 From: Naramsim Date: Fri, 20 Dec 2024 19:18:23 +0100 Subject: [PATCH 07/13] deps: downgrade python --- Resources/docker/app/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Resources/docker/app/Dockerfile b/Resources/docker/app/Dockerfile index 0e1ad02ac..ab28450b9 100644 --- a/Resources/docker/app/Dockerfile +++ b/Resources/docker/app/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.11.11-alpine3.21 +FROM python:3.10.16-alpine3.21 ENV PYTHONUNBUFFERED 1 ENV DJANGO_SETTINGS_MODULE 'config.docker-compose' From ba78d23571c59c86cc235f18bcf7585df392b66e Mon Sep 17 00:00:00 2001 From: Naramsim Date: Fri, 20 Dec 2024 21:29:52 +0100 Subject: [PATCH 08/13] deps: reset python --- Resources/docker/app/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Resources/docker/app/Dockerfile b/Resources/docker/app/Dockerfile index ab28450b9..5d8070c35 100644 --- a/Resources/docker/app/Dockerfile +++ b/Resources/docker/app/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.10.16-alpine3.21 +FROM python:3.10.14-alpine ENV PYTHONUNBUFFERED 1 ENV DJANGO_SETTINGS_MODULE 'config.docker-compose' From 811d1a123d405d5a400b016aec0cba9adc891115 Mon Sep 17 00:00:00 2001 From: Naramsim Date: Fri, 20 Dec 2024 21:51:26 +0100 Subject: [PATCH 09/13] deps: reset py --- Resources/docker/app/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Resources/docker/app/Dockerfile b/Resources/docker/app/Dockerfile index 5d8070c35..a8d2ac4da 100644 --- a/Resources/docker/app/Dockerfile +++ b/Resources/docker/app/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.10.14-alpine +FROM python:3.10-alpine ENV PYTHONUNBUFFERED 1 ENV DJANGO_SETTINGS_MODULE 'config.docker-compose' From f574938560ff2cb662209618d871d2061431b4c6 Mon Sep 17 00:00:00 2001 From: Naramsim Date: Sat, 21 Dec 2024 15:56:35 +0100 Subject: [PATCH 10/13] deps: try with binutils --- Resources/docker/app/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Resources/docker/app/Dockerfile b/Resources/docker/app/Dockerfile index a8d2ac4da..540bd3621 100644 --- a/Resources/docker/app/Dockerfile +++ b/Resources/docker/app/Dockerfile @@ -9,7 +9,7 @@ WORKDIR /code ADD requirements.txt /code/ RUN apk add --no-cache postgresql-libs libstdc++ RUN apk add --no-cache --virtual .build-deps gcc g++ musl-dev \ - postgresql-dev rust cargo && \ + postgresql-dev binutils rust cargo && \ python3 -m pip install -r requirements.txt --no-cache-dir && \ apk --purge del .build-deps ADD . /code/ From 92963979b0deabbe8218daf3163a24197a8ca778 Mon Sep 17 00:00:00 2001 From: Naramsim Date: Sat, 21 Dec 2024 16:16:44 +0100 Subject: [PATCH 11/13] deps: bump python/ use = separator/use square brackets in CMD --- Resources/docker/app/Dockerfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Resources/docker/app/Dockerfile b/Resources/docker/app/Dockerfile index 540bd3621..7b2f17e05 100644 --- a/Resources/docker/app/Dockerfile +++ b/Resources/docker/app/Dockerfile @@ -1,7 +1,7 @@ -FROM python:3.10-alpine +FROM python:3.10.16-alpine3.21 -ENV PYTHONUNBUFFERED 1 -ENV DJANGO_SETTINGS_MODULE 'config.docker-compose' +ENV PYTHONUNBUFFERED=1 +ENV DJANGO_SETTINGS_MODULE='config.docker-compose' RUN mkdir /code WORKDIR /code @@ -18,5 +18,5 @@ RUN addgroup -g 1000 -S pokeapi && \ adduser -u 1000 -S pokeapi -G pokeapi USER pokeapi -CMD gunicorn config.wsgi:application -c gunicorn.conf.py +CMD ["gunicorn", "config.wsgi:application", "-c", "gunicorn.conf.py"] EXPOSE 80 From 1427cba9cc96e94324d4d81dd56fca18f7f4d86a Mon Sep 17 00:00:00 2001 From: Naramsim Date: Sat, 21 Dec 2024 16:45:29 +0100 Subject: [PATCH 12/13] try: builder --- Resources/docker/app/Dockerfile | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/Resources/docker/app/Dockerfile b/Resources/docker/app/Dockerfile index 7b2f17e05..b801377fe 100644 --- a/Resources/docker/app/Dockerfile +++ b/Resources/docker/app/Dockerfile @@ -1,7 +1,6 @@ -FROM python:3.10.16-alpine3.21 +FROM python:3.10.16-alpine3.21 as builder ENV PYTHONUNBUFFERED=1 -ENV DJANGO_SETTINGS_MODULE='config.docker-compose' RUN mkdir /code WORKDIR /code @@ -10,13 +9,25 @@ ADD requirements.txt /code/ RUN apk add --no-cache postgresql-libs libstdc++ RUN apk add --no-cache --virtual .build-deps gcc g++ musl-dev \ postgresql-dev binutils rust cargo && \ - python3 -m pip install -r requirements.txt --no-cache-dir && \ - apk --purge del .build-deps + python3 -m pip install -r requirements.txt --no-cache-dir + +FROM python:3.10.16-alpine3.21 + +ENV PYTHONUNBUFFERED=1 +ENV DJANGO_SETTINGS_MODULE='config.docker-compose' + +RUN mkdir /code +WORKDIR /code + +COPY --from=builder /usr/local/lib/python3.10/site-packages /usr/local/lib/python3.10/site-packages +COPY --from=builder /usr/local/bin /usr/local/bin + ADD . /code/ RUN addgroup -g 1000 -S pokeapi && \ adduser -u 1000 -S pokeapi -G pokeapi - USER pokeapi + CMD ["gunicorn", "config.wsgi:application", "-c", "gunicorn.conf.py"] + EXPOSE 80 From c0d321a262359b5a6ae7cf37d9926df99e1dc5eb Mon Sep 17 00:00:00 2001 From: Naramsim Date: Sat, 21 Dec 2024 16:57:26 +0100 Subject: [PATCH 13/13] refactor: use uppercase AS/use ingressClassName --- Resources/docker/app/Dockerfile | 2 +- Resources/k8s/kustomize/base/other/ingress.yaml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Resources/docker/app/Dockerfile b/Resources/docker/app/Dockerfile index b801377fe..756abb3ce 100644 --- a/Resources/docker/app/Dockerfile +++ b/Resources/docker/app/Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.10.16-alpine3.21 as builder +FROM python:3.10.16-alpine3.21 AS builder ENV PYTHONUNBUFFERED=1 diff --git a/Resources/k8s/kustomize/base/other/ingress.yaml b/Resources/k8s/kustomize/base/other/ingress.yaml index 18e3f3d4a..2011842e0 100644 --- a/Resources/k8s/kustomize/base/other/ingress.yaml +++ b/Resources/k8s/kustomize/base/other/ingress.yaml @@ -3,7 +3,6 @@ kind: Ingress metadata: name: pokeapi-ingress annotations: - kubernetes.io/ingress.class: "haproxy" ingress.kubernetes.io/config-backend: | compression algo gzip compression type application/json @@ -13,6 +12,7 @@ spec: name: default-backend port: number: 8080 + ingressClassName: haproxy rules: - http: paths: @@ -29,7 +29,6 @@ kind: Ingress metadata: name: graphql-ingress annotations: - kubernetes.io/ingress.class: "haproxy" ingress.kubernetes.io/config-backend: | http-request replace-path /graphql(.*) \1 spec: @@ -38,6 +37,7 @@ spec: name: default-backend port: number: 8080 + ingressClassName: haproxy rules: - http: paths: