feat: adds a better dockerfile implementation
This commit is contained in:
37
Dockerfile
37
Dockerfile
@@ -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"]
|
||||
|
||||
Reference in New Issue
Block a user