# 2 stages build FROM python:3.12-slim AS python-base WORKDIR /app # We need to add the path of our virtual env to our $PATH environment variable : ENV PATH=".venv/bin:$PATH" # Our builder image to install the libraries FROM python-base AS python-builder RUN apt-get update && \ apt-get upgrade -y && \ apt-get install -y gcc \ && apt-get clean COPY ./requirements.txt ./ RUN python -m venv .venv # Install requirements RUN pip install -r requirements.txt # Our final image FROM python-base COPY --from=python-builder /app/.venv ./.venv COPY ./app /app EXPOSE 7860 ENTRYPOINT gunicorn --bind 0.0.0.0:7860 main:app