update Dockerfile for backend python

This commit is contained in:
Valentin CZERYBA 2023-10-16 23:25:24 +02:00
parent fa05870cbc
commit f78745ef7b

View File

@ -1,19 +1,11 @@
FROM tiangolo/uvicorn-gunicorn-fastapi:python3.11-slim AS backend-builder FROM python:3.11.6-alpine3.18
WORKDIR /app WORKDIR /app
COPY requierements.txt /app/ COPY requierements.txt /app/
RUN pip install --upgrade pip
RUN pip install -r requierements.txt
# Create the final image
FROM tiangolo/uvicorn-gunicorn-fastapi:python3.11-slim
WORKDIR /app
COPY --from=backend-builder /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages
COPY app /app/app COPY app /app/app
RUN pip install --upgrade pip && pip install -r requierements.txt
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"] CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]