From 1748639b43fb4b74b3b055e43432089f8789bc40 Mon Sep 17 00:00:00 2001 From: stanislas Date: Tue, 20 Feb 2024 18:18:00 +0100 Subject: [PATCH] Updated Dockerfile with smaller images --- Dockerfile | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 20dbd3f..592a1f2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,18 +1,25 @@ -FROM python:3.10 as build +FROM python:3.10-slim as build WORKDIR /tmp RUN pip install poetry COPY ./pyproject.toml ./poetry.lock* /tmp/ -RUN poetry export -f requirements.txt --output requirements.txt --without-hashes +RUN poetry export -f requirements.txt --output requirements.txt --without-hashes --without dev -FROM python:3.10 +ENV VIRTUAL_ENV=/opt/venv +ENV PATH="$VIRTUAL_ENV/bin:$PATH" +RUN python -m venv $VIRTUAL_ENV && \ + pip install --no-cache-dir --upgrade -r requirements.txt + +FROM python:3.10-alpine WORKDIR /app -COPY --from=build /tmp/requirements.txt /code/requirements.txt -RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt +ENV VIRTUAL_ENV=/opt/venv +ENV PATH="$VIRTUAL_ENV/bin:$PATH" + +COPY --from=build $VIRTUAL_ENV $VIRTUAL_ENV COPY resa_padel/ /app/ -CMD python . \ No newline at end of file +CMD python .