Skip to content

Commit

Permalink
Simplify dockerfile (#28)
Browse files Browse the repository at this point in the history
* simplified docker file and extracted gunicorn commands to gunicorn.conf.py

* removed yaml reading of arguments for gunicorn: the referenced docker-compose.yml would have been the one in the container and therefore effectively hard-coded

* README additions and increase of version in docker-compose.yml
  • Loading branch information
fmatthies authored Oct 4, 2024
1 parent b57a497 commit dba5bdf
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 15 deletions.
12 changes: 3 additions & 9 deletions inception_ahd_recommender/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,12 @@ FROM $ROOT_CONTAINER

ARG RECOMMENDER_WORKDIR=/inception_ahd_recommender

ARG RECOMMENDER_WORKERS
ARG RECOMMENDER_ADDRESS

WORKDIR $RECOMMENDER_WORKDIR


COPY . .

RUN python -m pip install --upgrade pip
RUN python -m pip install gunicorn
RUN python -m pip install -e .
RUN python -m pip install -e ".[contrib]"

RUN python -m pip install -e . &&\
python -m pip install -e ".[contrib]"

CMD gunicorn -w $RECOMMENDER_WORKERS -b $RECOMMENDER_ADDRESS --log-level INFO main:app
ENTRYPOINT ["gunicorn"]
14 changes: 13 additions & 1 deletion inception_ahd_recommender/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,4 +151,16 @@ Der Recommender `docker` Container (wenn das `RECOMMENDER_WORKDIR` in der `docke
* `deid_mapping_singlelayer.json`
* `deid_mapping_multilayer.json`

Eine von denen kann dann auch mit ``<MAPPING_FILE>``=`/inception_ahd_recommender/prefab-mapping-files/<FILE>` referenziert werden.
Eine von denen kann dann auch mit ``<MAPPING_FILE>``=`/inception_ahd_recommender/prefab-mapping-files/<FILE>` referenziert werden.

## Entwicklung
### Versionsupdate
Wenn eine neue Version des Recommenders veröffentlicht werden soll, muss die Datei `VERSION` geändert werden
(dadurch wird der entsprechende workflow getriggert, sobald die Veränderung auf den `main` branch kommt → siehe `.github/workflows/ci.yaml`).
Bitte beachten, dass dann auch das version tag Suffix in der `docker-compose.yml` angepasst wird:
```
services:
ahd-deid-recommender:
image: ghcr.io/medizininformatik-initiative/gemtex/inception-ahd-recommender:1.1.2
[...]
```
2 changes: 1 addition & 1 deletion inception_ahd_recommender/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.1.1
1.1.2
6 changes: 2 additions & 4 deletions inception_ahd_recommender/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
services:
ahd-deid-recommender:
build:
context: .
image: ahd-deid-recommender:1.1.1
image: ghcr.io/medizininformatik-initiative/gemtex/inception-ahd-recommender:1.1.2
restart: unless-stopped
environment:
- EXTERNAL_SERVER_ADDRESS=http://198.168.10.2:8080
Expand All @@ -15,7 +13,7 @@ services:
- RECOMMENDER_WORKERS=4
- RECOMMENDER_ADDRESS=:5000
ports:
- 5000:5000
- "5000:5000"
networks:
- recommender-network
networks:
Expand Down
6 changes: 6 additions & 0 deletions inception_ahd_recommender/gunicorn.conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import os

workers = os.environ.get("RECOMMENDER_WORKERS", "2")
bind = os.environ.get("RECOMMENDER_ADDRESS", ":5000")
log_level = 'info'
wsgi_app = "main:app"

0 comments on commit dba5bdf

Please sign in to comment.