1- FROM python:3.13.5 -slim-bookworm AS base
1+ FROM python:3.14 -slim-trixie AS base
22
33ENV PYTHONUNBUFFERED=1
44WORKDIR /build
55
66# Create requirements.txt file
7- FROM base AS poetry
8- RUN pip install poetry==2.1.3
9- RUN poetry self add poetry-plugin-export
10- COPY poetry.lock pyproject.toml ./
11- RUN poetry export -o /requirements.txt --without-hashes
7+ FROM base AS uv
8+ COPY --from=ghcr.io/astral-sh/uv:0.9.2 /uv /uvx /bin/
9+ COPY uv.lock pyproject.toml ./
10+ RUN uv export --no-dev --no-hashes -o /requirements.txt --no-install-workspace --frozen
11+ RUN uv export --only-group dev --no-hashes - o /requirements-dev .txt --no-install-workspace --frozen
1212
1313FROM base AS final
14- COPY --from=poetry /requirements.txt .
14+ COPY --from=uv /requirements.txt .
1515
1616# Create venv, add it to path and install requirements
1717RUN python -m venv /venv
@@ -28,8 +28,9 @@ COPY alembic.ini .
2828COPY pyproject.toml .
2929COPY init.sh .
3030
31- # Expose port
31+ # Expose port 8000 for app and optional 9090 for prometheus metrics
3232EXPOSE 8000
33+ EXPOSE 9090
3334
3435# Make the init script executable
3536RUN chmod +x ./init.sh
@@ -39,4 +40,4 @@ ENTRYPOINT ["./init.sh"]
3940
4041# Set CMD to uvicorn
4142# /venv/bin/uvicorn is used because from entrypoint script PATH is new
42- CMD ["/venv/bin/uvicorn" , "app.main:app" , "--host" , "0.0.0.0" , "--port" , "8000" , "--workers" , "2 " , "--loop" , "uvloop" ]
43+ CMD ["/venv/bin/uvicorn" , "app.main:app" , "--host" , "0.0.0.0" , "--port" , "8000" , "--workers" , "1 " , "--loop" , "uvloop" ]
0 commit comments