feat: adds a better dockerfile implementation

This commit is contained in:
2025-11-08 09:45:05 -03:00
parent 08faca95af
commit 1b09805665
5 changed files with 1261 additions and 994 deletions

View File

@@ -1,11 +1,38 @@
FROM python:3.12
FROM python:3.12-slim-bookworm AS base
FROM base AS dependencies
RUN apt-get update && \
apt-get install -y build-essential curl && \
rm -rf /var/lib/apt/lists/*
ENV POETRY_NO_INTERACTION=1
ENV POETRY_VERSION=2.2.1
# System deps:
RUN curl -sSL https://install.python-poetry.org | python3 -
ENV PATH="/root/.local/bin:$PATH"
WORKDIR /app
RUN pip install poetry
COPY pyproject.toml poetry.toml poetry.lock ./
RUN poetry sync --without=dev --no-root --no-interaction --no-ansi
COPY ./ /app/
RUN poetry install
FROM base AS runtime
ENTRYPOINT ["poetry", "run", "python", "-m", "storage_service"]
WORKDIR /app
COPY --from=dependencies /app/.venv ./
COPY . .
ENV PYTHONUNBUFFERED=1
ENV VIRTUAL_ENV=/app/.venv
ENTRYPOINT ["python", "-m", "storage_service"]