From c011018e8b2a7935082fea4f10ede4a91b1b6413 Mon Sep 17 00:00:00 2001 From: David <39565245+dmunozv04@users.noreply.github.com> Date: Thu, 3 Feb 2022 12:54:57 +0100 Subject: [PATCH] Update Dockerfile --- Dockerfile | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 18e07e1..0c54894 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,16 +1,25 @@ # syntax=docker/dockerfile:1 +FROM python:3.10-bullseye AS compile-image + +RUN apt-get update && \ + apt-get install -y --no-install-recommends build-essential gcc + +RUN python -m venv /opt/venv + +ENV PATH="/opt/venv/bin:$PATH" + +COPY requirements.txt . +RUN pip install -r requirements.txt + FROM python:3.10-slim-bullseye +COPY --from=compile-image /opt/venv /opt/venv + +ENV PATH="/opt/venv/bin:$PATH" + WORKDIR /app -RUN apt-get update && \ - apt-get install -y gcc - -COPY requirements.txt . - -RUN pip3 install -r requirements.txt - COPY main.py . -ENTRYPOINT ["python3", "main.py"] +ENTRYPOINT ["/opt/venv/bin/python3", "main.py"]