Skip to content

Commit 484e46d

Browse files
committed
Add entrypoint script which dynamically writes gunicorn.conf.py to handle user/group=None
1 parent e7418d1 commit 484e46d

File tree

2 files changed

+19
-10
lines changed

2 files changed

+19
-10
lines changed

Dockerfile

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,9 @@ RUN \
2727
apk del build-deps
2828

2929
ADD src /srv/qwc_service/
30+
ADD entrypoint.sh /entrypoint.sh
3031

3132
ENV LD_LIBRARY_PATH=/usr/lib/jvm/java-21-openjdk/lib/server
3233
ENV SERVICE_MOUNTPOINT=/api/v1/document
3334

34-
ENTRYPOINT ["/bin/sh", "-c", "\
35-
HOME=/tmp gunicorn --chdir /srv/qwc_service \
36-
--bind :9090 \
37-
--workers $UWSGI_PROCESSES \
38-
--threads $UWSGI_THREADS \
39-
--user $SERVICE_UID --group $SERVICE_GID \
40-
--worker-class gthread \
41-
--pythonpath /srv/qwc_service/.venv/lib/python*/site-packages \
42-
--access-logfile - \
43-
server:app"]
35+
ENTRYPOINT ["sh", "/entrypoint.sh"]

entrypoint.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/sh
2+
3+
cat > /tmp/gunicorn.conf.py <<EOF
4+
user = ${SERVICE_UID:-None}
5+
group = ${SERVICE_GID:-None}
6+
EOF
7+
8+
HOME=/tmp gunicorn \
9+
--chdir /srv/qwc_service \
10+
--bind :9090 \
11+
--workers $UWSGI_PROCESSES \
12+
--threads $UWSGI_THREADS \
13+
--worker-class gthread \
14+
--pythonpath /srv/qwc_service/.venv/lib/python*/site-packages \
15+
--access-logfile - \
16+
-c /tmp/gunicorn.conf.py \
17+
server:app

0 commit comments

Comments
 (0)