From e4a6b3336634bb59253b41459d6c15a7bd4f8061 Mon Sep 17 00:00:00 2001 From: Lebaud Antoine Date: Tue, 19 Mar 2024 18:16:36 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B(docker)=20switch=20CMD=20form=20fr?= =?UTF-8?q?om=20Shell=20to=20Exec?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `backend-development` and `backend-production` CMD syntaxes were using a Shell Form. Shell form prevented Unix signals from reaching our container correctly, such as SIGTERM. Also, the shell process ends up being the PID 1, instead of our Python scripts. Docker recommends to use the exec form whenever possible. --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4d39a6a..10e3fab 100644 --- a/Dockerfile +++ b/Dockerfile @@ -172,7 +172,7 @@ ENV DB_HOST=postgresql \ DB_PORT=5432 # Run django development server -CMD python manage.py runserver 0.0.0.0:8000 +CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"] # ---- Production image ---- FROM core as backend-production @@ -194,4 +194,4 @@ COPY --from=link-collector ${PEOPLE_STATIC_ROOT} ${PEOPLE_STATIC_ROOT} COPY --from=mail-builder /mail/backend/core/templates/mail /app/core/templates/mail # The default command runs gunicorn WSGI server in people's main module -CMD gunicorn -c /usr/local/etc/gunicorn/people.py people.wsgi:application +CMD ["gunicorn", "-c", "/usr/local/etc/gunicorn/people.py", "people.wsgi:application"]