-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
35 lines (23 loc) · 947 Bytes
/
Dockerfile
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
30
31
32
33
34
35
FROM python:3.11.8
# Create non-root group and user
RUN addgroup --system dash_app \
&& adduser --system --home /var/cache/dash_app --ingroup dash_app --uid 1001 dashuser
USER dashuser
WORKDIR /dash_app/
COPY --chown=dashuser requirements.txt /dash_app/
# Elegantly activating a venv in Dockerfile: https://pythonspeed.com/articles/activate-virtualenv-dockerfile/
ENV VIRTUAL_ENV=/dash_app/venv
RUN python3 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
# Install requirements
RUN pip install --trusted-host pypi.python.org -r requirements.txt
COPY --chown=dashuser /klimainsights/ /dash_app/klimainsights/
WORKDIR /dash_app/klimainsights/
# set enviroment variables
# This prevent Python from writing out pyc files
ENV PYTHONDONTWRITEBYTECODE=1
# This keeps Python from buffering stdin/stdout
ENV PYTHONUNBUFFERED=1
ENV ENV_FILE=".env"
EXPOSE 7000
ENTRYPOINT ["gunicorn", "index:server", "-b", "0.0.0.0:7860", "--workers=1"]