diff --git a/Dockerfile b/Dockerfile index 81aa63e60..8553671bb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,13 +19,14 @@ EXPOSE 80/tcp ENV FLASK_APP=files/cli:app +CMD [ "bootstrap/init.sh" ] + ################################################################### # Release container FROM base AS release COPY bootstrap/supervisord.conf.release /etc/supervisord.conf -CMD [ "/usr/local/bin/supervisord", "-c", "/etc/supervisord.conf" ] ################################################################### @@ -37,7 +38,6 @@ COPY thirdparty/sqlalchemy-easy-profile sqlalchemy-easy-profile RUN cd sqlalchemy-easy-profile && python3 setup.py install COPY bootstrap/supervisord.conf.dev /etc/supervisord.conf -CMD [ "/usr/local/bin/supervisord", "-c", "/etc/supervisord.conf" ] ################################################################### diff --git a/bootstrap/init.sh b/bootstrap/init.sh new file mode 100644 index 000000000..054238a19 --- /dev/null +++ b/bootstrap/init.sh @@ -0,0 +1,6 @@ +#!/bin/bash +set -euxo pipefail + +python3 -m flask db upgrade # this does not actually return error codes properly! + +/usr/local/bin/supervisord -c /etc/supervisord.conf diff --git a/bootstrap/supervisord.conf.dev b/bootstrap/supervisord.conf.dev index 3bf95b574..60a51bb6e 100644 --- a/bootstrap/supervisord.conf.dev +++ b/bootstrap/supervisord.conf.dev @@ -12,7 +12,7 @@ supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface [program:service] directory=/service -command=sh -c 'python3 -m flask db upgrade && WERKZEUG_DEBUG_PIN=off ENABLE_SERVICES=true python3 -m flask --debug run --host=0.0.0.0 --port=80' +command=sh -c 'WERKZEUG_DEBUG_PIN=off ENABLE_SERVICES=true python3 -m flask --debug run --host=0.0.0.0 --port=80' stdout_logfile=/dev/stdout stdout_logfile_maxbytes=0 stderr_logfile=/dev/stderr diff --git a/bootstrap/supervisord.conf.release b/bootstrap/supervisord.conf.release index df0981f40..ab3843d6f 100644 --- a/bootstrap/supervisord.conf.release +++ b/bootstrap/supervisord.conf.release @@ -12,7 +12,7 @@ supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface [program:service] directory=/service -command=sh -c 'python3 -m flask db upgrade && ENABLE_SERVICES=true gunicorn files.__main__:app -k gevent -w ${CORE_OVERRIDE:-$(( `nproc` * 2 ))} --reload -b 0.0.0.0:80 --max-requests 1000 --max-requests-jitter 500' +command=sh -c 'ENABLE_SERVICES=true gunicorn files.__main__:app -k gevent -w ${CORE_OVERRIDE:-$(( `nproc` * 2 ))} --reload -b 0.0.0.0:80 --max-requests 1000 --max-requests-jitter 500' stdout_logfile=/dev/stdout stdout_logfile_maxbytes=0 stderr_logfile=/dev/stderr