Skip to content

Commit

Permalink
feat(gunicorn): Add config (#3894)
Browse files Browse the repository at this point in the history
### Changed

- Add Gunicorn config
- Update werkzeug
  • Loading branch information
henrikstranneheim authored Nov 25, 2024
1 parent 429f7d9 commit 0ce6422
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 22 deletions.
21 changes: 3 additions & 18 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
FROM docker.io/library/python:3.11-slim-bullseye

ENV GUNICORN_WORKERS=1
ENV GUNICORN_THREADS=1
ENV GUNICORN_BIND="0.0.0.0:8000"
ENV GUNICORN_TIMEOUT=400


ENV CG_SQL_DATABASE_URI="sqlite:///:memory:"
ENV CG_SECRET_KEY="key"

Check warning on line 4 in Dockerfile

View workflow job for this annotation

GitHub Actions / docker-image-push

Sensitive data should not be used in the ARG or ENV commands

SecretsUsedInArgOrEnv: Do not use ARG or ENV instructions for sensitive data (ENV "CG_SECRET_KEY") More info: https://docs.docker.com/go/dockerfile/rule/secrets-used-in-arg-or-env/

Expand All @@ -29,7 +23,7 @@ ENV TRAILBLAZER_SERVICE_ACCOUNT_AUTH_FILE="auth_file"


WORKDIR /home/src/app
COPY pyproject.toml poetry.lock ./
COPY pyproject.toml poetry.lock gunicorn.conf.py ./

RUN pip install --no-cache-dir poetry \
&& poetry config virtualenvs.create false \
Expand All @@ -38,14 +32,5 @@ RUN pip install --no-cache-dir poetry \
COPY cg ./cg

CMD gunicorn \

Check warning on line 34 in Dockerfile

View workflow job for this annotation

GitHub Actions / docker-image-push

JSON arguments recommended for ENTRYPOINT/CMD to prevent unintended behavior related to OS signals

JSONArgsRecommended: JSON arguments recommended for CMD to prevent unintended behavior related to OS signals More info: https://docs.docker.com/go/dockerfile/rule/json-args-recommended/
--workers=$GUNICORN_WORKERS \
--bind=$GUNICORN_BIND \
--threads=$GUNICORN_THREADS \
--timeout=$GUNICORN_TIMEOUT \
--proxy-protocol \
--forwarded-allow-ips="10.0.2.100,127.0.0.1" \
--log-syslog \
--access-logfile - \
--error-logfile - \
--log-level="debug" \
cg.server.auto:app
--config gunicorn.conf.py \
cg.server.auto:app
9 changes: 9 additions & 0 deletions gunicorn.conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
bind = "0.0.0.0:8000"
threads = 4
timeout = 400
loglevel = "debug"
protocol = "proxy"
syslog = True
forwarded_allow_ips = "10.0.2.100,127.0.0.1"
accesslog = "-"
workers = 2
8 changes: 4 additions & 4 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0ce6422

Please sign in to comment.