forked from AlessioCasco/Automerge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
28 lines (21 loc) · 999 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
FROM debian:12-slim AS build
# Prevents Python from writing pyc files.
ENV PYTHONDONTWRITEBYTECODE=1
# Keeps Python from buffering stdout and stderr to avoid situations where
# the application crashes without emitting any logs due to buffering.
ENV PYTHONUNBUFFERED=1
RUN apt-get update && \
apt-get install --no-install-suggests --no-install-recommends --yes python3-venv gcc libpython3-dev && \
python3 -m venv /venv && \
/venv/bin/pip install --upgrade pip setuptools wheel
FROM build AS build-venv
COPY requirements.txt .
RUN /venv/bin/pip install --disable-pip-version-check -r /requirements.txt
# Using the distroless python3-debian12:nonroot image
FROM gcr.io/distroless/python3-debian12@sha256:66f3e24fd4906156a7360d2861731d31d3457a02f34fd3c4491f0b710a259988 AS runtime
COPY --from=build-venv /venv /venv
# copy the content of the local src directory to the working directory
COPY src/ /app
WORKDIR /app
# Run the application.
ENTRYPOINT [ "/venv/bin/python3", "main.py"]