-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
29 lines (19 loc) · 800 Bytes
/
Dockerfile
File metadata and controls
29 lines (19 loc) · 800 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
FROM python:3.12.1
RUN pip install --upgrade pip
# Keeps Python from generating .pyc files in the container
ENV PYTHONDONTWRITEBYTECODE=1
# Turns off buffering for easier container logging
ENV PYTHONUNBUFFERED=1
# Creates a non-root user
WORKDIR /code
RUN adduser -u 5678 --disabled-password --gecos "" appuser && chown -R appuser /code
# install deps
COPY requirements.txt requirements.txt
RUN pip install --no-cache-dir --disable-pip-version-check --requirement requirements.txt
# change user https://stackoverflow.com/questions/73174175/gunicorn-command-not-found
USER appuser
COPY ./app /code/app
COPY ./training_data /code/training_data
ENV WORKERS=1
CMD gunicorn app.main:app --preload -b 0.0.0.0:8081 -w $WORKERS -k uvicorn.workers.UvicornWorker --forwarded-allow-ips "*"
EXPOSE 8081