From 95d4a1856a9474b7d99ce29c30999b8fc1cfe478 Mon Sep 17 00:00:00 2001 From: Barden Date: Sat, 21 Feb 2026 20:16:09 +0300 Subject: [PATCH] Updated Dockerfile, made multi-stage --- Dockerfile | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 94fbd42..954dda7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,26 @@ -FROM python:3.13-slim +FROM python:3.13-slim AS builder WORKDIR /app +COPY requirements.txt . + +RUN python3 -m venv /opt/venv + +ENV PATH="/opt/venv/bin:$PATH" + +RUN pip install --no-cache-dir -r requirements.txt + +FROM python:3.13-slim + ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONUNBUFFERED=1 -COPY requirements.txt . +WORKDIR /app -RUN pip install --no-cache-dir -r requirements.txt +COPY --from=builder /opt/venv /opt/venv COPY . . +ENV PATH="/opt/venv/bin:$PATH" + CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"] \ No newline at end of file