diff --git a/medcat-model-distributor/docker-compose-test.yml b/medcat-model-distributor/docker-compose-test.yml index d1ce643de..9b0b20888 100644 --- a/medcat-model-distributor/docker-compose-test.yml +++ b/medcat-model-distributor/docker-compose-test.yml @@ -2,11 +2,6 @@ services: medcatweb: build: context: ./webapp - command: > - bash -c " - python manage.py migrate --noinput && - /etc/init.d/cron start && - python manage.py runserver 0.0.0.0:8000" volumes: - ../medcat-v2/tests/resources:/webapp/models ports: diff --git a/medcat-model-distributor/docker-compose.yml b/medcat-model-distributor/docker-compose.yml index c75f43111..293a094da 100644 --- a/medcat-model-distributor/docker-compose.yml +++ b/medcat-model-distributor/docker-compose.yml @@ -1,11 +1,6 @@ services: medcatweb: image: cogstacksystems/medcat-model-distributor - command: > - bash -c " - python manage.py migrate --noinput && - /etc/init.d/cron start && - python manage.py runserver 0.0.0.0:8000" volumes: - ./webapp/data:/webapp/data - ./webapp/db:/webapp/db diff --git a/medcat-model-distributor/envs/env_medmen b/medcat-model-distributor/envs/env_medmen index 9952ef961..e69de29bb 100644 --- a/medcat-model-distributor/envs/env_medmen +++ b/medcat-model-distributor/envs/env_medmen @@ -1 +0,0 @@ -MODEL_PACK_PATH=// diff --git a/medcat-model-distributor/envs/env_medmen_test b/medcat-model-distributor/envs/env_medmen_test index 21baaf5c7..e69de29bb 100644 --- a/medcat-model-distributor/envs/env_medmen_test +++ b/medcat-model-distributor/envs/env_medmen_test @@ -1 +0,0 @@ -MODEL_PACK_PATH=/webapp/models/mct2_model_pack.zip diff --git a/medcat-model-distributor/webapp/Dockerfile b/medcat-model-distributor/webapp/Dockerfile index 416a5974c..0ba223929 100644 --- a/medcat-model-distributor/webapp/Dockerfile +++ b/medcat-model-distributor/webapp/Dockerfile @@ -47,3 +47,11 @@ RUN chmod 0644 /etc/cron.d/db-backup-cron && crontab /etc/cron.d/db-backup-cron # Run collect static (could be in entrypoint script) RUN python manage.py collectstatic --noinput + +# setup entrypoint +COPY entrypoint.sh /webapp/entrypoint.sh +RUN chmod +x /webapp/entrypoint.sh +# this does migration and cron job +ENTRYPOINT ["/webapp/entrypoint.sh"] +# and then, finally runs the (flexible) runserver command +CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"] diff --git a/medcat-model-distributor/webapp/entrypoint.sh b/medcat-model-distributor/webapp/entrypoint.sh new file mode 100644 index 000000000..4335118bb --- /dev/null +++ b/medcat-model-distributor/webapp/entrypoint.sh @@ -0,0 +1,6 @@ +#!/bin/bash +set -e + +python manage.py migrate --noinput +/etc/init.d/cron start || echo "cron failed, continuing" +exec "$@" \ No newline at end of file