-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
40 lines (33 loc) · 949 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
36
37
38
39
40
#
# Stage 1
#
FROM debian:11-slim AS build
# Install system requirements for Python and Python virtual environment
ENV VIRTUAL_ENV=/venv
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
RUN apt-get update \
&& apt-get install --no-install-suggests --no-install-recommends --yes \
python3-venv \
gcc \
libpython3-dev \
tzdata \
&& python3 -m venv $VIRTUAL_ENV \
&& pip install --upgrade pip setuptools wheel \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Install Python requirements
COPY requirements.txt /requirements.txt
RUN pip install --disable-pip-version-check -r /requirements.txt
#
# Stage 2
#
# FROM gcr.io/distroless/python3-debian11:debug AS production
FROM gcr.io/distroless/python3-debian11 AS production
ENV TZ=Europe/Warsaw
ENV PYTHONUNBUFFERED=1
ENV VIRTUAL_ENV=/venv
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
COPY --from=build /venv /venv
WORKDIR /app
COPY ./ /app
ENTRYPOINT ["python", "main.py"]