From 3b89b50c6859d03e5bc21158fea05e182b3033a8 Mon Sep 17 00:00:00 2001 From: mart-r Date: Mon, 2 Mar 2026 09:40:37 +0000 Subject: [PATCH 1/6] CU-869cak2rx: Move to an entrypoint for image --- medcat-model-distributor/webapp/Dockerfile | 8 ++++++++ medcat-model-distributor/webapp/entrypoint.sh | 7 +++++++ 2 files changed, 15 insertions(+) create mode 100644 medcat-model-distributor/webapp/entrypoint.sh diff --git a/medcat-model-distributor/webapp/Dockerfile b/medcat-model-distributor/webapp/Dockerfile index 416a5974c..afe3d3b98 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 /entrypoint.sh +RUN chmod +x /entrypoint.sh +# this does migration and cron job +ENTRYPOINT ["/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..e7d5a5103 --- /dev/null +++ b/medcat-model-distributor/webapp/entrypoint.sh @@ -0,0 +1,7 @@ +# entrypoint.sh +#!/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 From 2ee4e03d9ced44a55ac7948c75953c64ffa6f094 Mon Sep 17 00:00:00 2001 From: mart-r Date: Mon, 2 Mar 2026 09:41:01 +0000 Subject: [PATCH 2/6] CU-869cak2rx: Remove command from compose file(s) --- medcat-model-distributor/docker-compose-test.yml | 5 ----- medcat-model-distributor/docker-compose.yml | 5 ----- 2 files changed, 10 deletions(-) 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 From 358381c04aa68f052281d23d0bb82ea12813a574 Mon Sep 17 00:00:00 2001 From: mart-r Date: Mon, 2 Mar 2026 10:02:42 +0000 Subject: [PATCH 3/6] CU-869cak2rx: Fix entrypoint script path --- medcat-model-distributor/webapp/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/medcat-model-distributor/webapp/Dockerfile b/medcat-model-distributor/webapp/Dockerfile index afe3d3b98..3ed70e257 100644 --- a/medcat-model-distributor/webapp/Dockerfile +++ b/medcat-model-distributor/webapp/Dockerfile @@ -52,6 +52,6 @@ RUN python manage.py collectstatic --noinput COPY entrypoint.sh /entrypoint.sh RUN chmod +x /entrypoint.sh # this does migration and cron job -ENTRYPOINT ["/entrypoint.sh"] +ENTRYPOINT ["/webapp/entrypoint.sh"] # and then, finally runs the (flexible) runserver command CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"] From 75845de126c18f09e21a81675a755d0b2701b599 Mon Sep 17 00:00:00 2001 From: mart-r Date: Mon, 2 Mar 2026 10:09:55 +0000 Subject: [PATCH 4/6] CU-869cak2rx: Fix entrypoint script path (2) --- medcat-model-distributor/webapp/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/medcat-model-distributor/webapp/Dockerfile b/medcat-model-distributor/webapp/Dockerfile index 3ed70e257..0ba223929 100644 --- a/medcat-model-distributor/webapp/Dockerfile +++ b/medcat-model-distributor/webapp/Dockerfile @@ -49,8 +49,8 @@ RUN chmod 0644 /etc/cron.d/db-backup-cron && crontab /etc/cron.d/db-backup-cron RUN python manage.py collectstatic --noinput # setup entrypoint -COPY entrypoint.sh /entrypoint.sh -RUN chmod +x /entrypoint.sh +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 From 78fc564c73c8b3b74c3bc9e59d583a0fe66c7f76 Mon Sep 17 00:00:00 2001 From: mart-r Date: Mon, 2 Mar 2026 10:21:51 +0000 Subject: [PATCH 5/6] CU-869cak2rx: Fix entrypoint script shebang --- medcat-model-distributor/webapp/entrypoint.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/medcat-model-distributor/webapp/entrypoint.sh b/medcat-model-distributor/webapp/entrypoint.sh index e7d5a5103..4335118bb 100644 --- a/medcat-model-distributor/webapp/entrypoint.sh +++ b/medcat-model-distributor/webapp/entrypoint.sh @@ -1,4 +1,3 @@ -# entrypoint.sh #!/bin/bash set -e From 9bb89f5117498e6aa05087e1e931bb81e519439c Mon Sep 17 00:00:00 2001 From: mart-r Date: Mon, 2 Mar 2026 10:25:13 +0000 Subject: [PATCH 6/6] CU-869cak2rx: Remove unused env variable --- medcat-model-distributor/envs/env_medmen | 1 - medcat-model-distributor/envs/env_medmen_test | 1 - 2 files changed, 2 deletions(-) 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