From 693257577fa93acdc4f51c19f7e1e732897747b0 Mon Sep 17 00:00:00 2001 From: SALO Date: Thu, 23 Jan 2025 14:22:59 +0200 Subject: [PATCH] Update Dockerfile --- Dockerfile | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index 56f3718..1aee5d1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,33 +1,33 @@ -FROM python:3.12 AS poetry +FROM python:3.12-slim AS poetry ENV PATH "/root/.local/bin:${PATH}" ENV PYTHONUNBUFFERED 1 -ENV POETRY_VIRTUALENVS_IN_PROJECT 1 WORKDIR /root SHELL ["/bin/bash", "-o", "pipefail", "-c"] RUN apt-get update && \ apt-get install curl -y --no-install-recommends && \ - curl -sSL https://install.python-poetry.org | python - + curl -sSL https://install.python-poetry.org | python - && \ + poetry self add poetry-plugin-export COPY poetry.lock pyproject.toml ./ -RUN poetry install --only main,docker --no-root +RUN poetry export --no-interaction -o requirements.txt --without-hashes --only main,docker FROM python:3.12-slim AS base ENV PYTHONPATH "/app" - WORKDIR /app RUN groupadd -g 5000 container && useradd -d /app -m -g container -u 5000 container - -COPY --from=poetry /root/.venv ./.venv -COPY . . +COPY --from=poetry /root/requirements.txt ./ +RUN pip --no-cache-dir install -U pip && \ + pip --no-cache-dir install -r requirements.txt +COPY src/ src/ FROM base AS final RUN chown -R 5000:5000 /app USER container -CMD [".venv/bin/dumb-init", ".venv/bin/python", "main.py"] +CMD ["dumb-init", "python", "-m", "src"]