-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
52 lines (42 loc) · 1.11 KB
/
Dockerfile
File metadata and controls
52 lines (42 loc) · 1.11 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
ARG PYTHON_DOCKER_IMAGE
# Base Poetry layer
FROM $PYTHON_DOCKER_IMAGE AS python-base
# Bootstrap folders & non-root user
RUN mkdir -p /app && \
chown 1000:1000 -R /app
# System env
ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8
ENV PATH="/root/.local/bin:/app:${PATH}"
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y gcc \
&& apt-get clean
# Python env
ENV PYTHONPATH="/root/.local/bin:/app:${PYTHONPATH}"
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONASYNCIODEBUG=1
ENV PIP_NO_CACHE_DIR=1
# Bootstrap poetry
WORKDIR /app
ENV POETRY_VIRTUALENVS_CREATE=false
RUN pip install poetry --no-warn-script-location
# Requirements layer
FROM python-base AS python-app
COPY pyproject.toml ./pyproject.toml
COPY poetry.lock ./poetry.lock
RUN poetry install --only=main --no-root --no-interaction --no-ansi
FROM python-app as app
# Add server source & entrypoint
COPY server ./server
RUN chmod +x /app/server/entrypoint.sh
# Add modules
# App environment
ENV HOSTNAME=0.0.0.0
ENV PORT=5001
ENV ENABLE_HTTPS_REDIRECT=
ENV USE_JSON_LOGGING=
# Launch app
USER 1000
ENTRYPOINT ["server/entrypoint.sh"]