🐛(docker) switch CMD form from Shell to Exec

`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.
This commit is contained in:
Lebaud Antoine
2024-03-19 18:16:36 +01:00
committed by aleb_the_flash
parent 44b5999df8
commit e4a6b33366

View File

@@ -172,7 +172,7 @@ ENV DB_HOST=postgresql \
DB_PORT=5432 DB_PORT=5432
# Run django development server # 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 ---- # ---- Production image ----
FROM core as backend-production 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 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 # 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"]