From 4326dc2299e0d0686c4c675ca7b3453476e8efb2 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Wed, 22 Feb 2023 08:53:42 +0000 Subject: [PATCH] Add helper entrypoint scripts This keeps the configuration for what to run inside the container, without adding the extra weight and config of s6 --- Dockerfile | 2 +- etc/entrypoints/cron | 5 +++++ etc/entrypoints/nginx | 5 +++++ etc/entrypoints/web | 7 +++++++ etc/entrypoints/worker | 5 +++++ 5 files changed, 23 insertions(+), 1 deletion(-) create mode 100755 etc/entrypoints/cron create mode 100755 etc/entrypoints/nginx create mode 100755 etc/entrypoints/web create mode 100755 etc/entrypoints/worker diff --git a/Dockerfile b/Dockerfile index 5b4e6ed..7718247 100644 --- a/Dockerfile +++ b/Dockerfile @@ -51,7 +51,7 @@ COPY --chown=website ./website ./website RUN SECRET_KEY=none python manage.py collectstatic --noinput --clear -CMD python manage.py migrate --noinput && gunicorn -c etc/gunicorn.conf.py +CMD ["/app/etc/entrypoints/web"] # Just dev stuff FROM production as dev diff --git a/etc/entrypoints/cron b/etc/entrypoints/cron new file mode 100755 index 0000000..50cca3e --- /dev/null +++ b/etc/entrypoints/cron @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +set -e + +exec supercronic etc/crontab diff --git a/etc/entrypoints/nginx b/etc/entrypoints/nginx new file mode 100755 index 0000000..b9db4da --- /dev/null +++ b/etc/entrypoints/nginx @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +set -e + +exec nginx -g "daemon off;" diff --git a/etc/entrypoints/web b/etc/entrypoints/web new file mode 100755 index 0000000..e4146f6 --- /dev/null +++ b/etc/entrypoints/web @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +set -e + +python manage.py migrate --noinput + +exec gunicorn -c etc/gunicorn.conf.py diff --git a/etc/entrypoints/worker b/etc/entrypoints/worker new file mode 100755 index 0000000..c7315ee --- /dev/null +++ b/etc/entrypoints/worker @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +set -e + +exec python manage.py rqworker --with-scheduler