Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
FROM python:3.12-slim-bookworm
FROM python:3.13-slim-bookworm

COPY app /app
COPY README.md /README.md
COPY requirements.txt /requirements.txt
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can try using multi-stage docker builds, please check this https://ashishb.net/programming/using-python-uv-inside-docker/

RUN pip install -r requirements.txt
WORKDIR /app

CMD ["python", "-m", "app.app"]
COPY pyproject.toml uv.lock ./
RUN uv sync --frozen --no-dev --no-install-project

COPY app ./app
COPY README.md ./

CMD ["uv", "run", "python", "-m", "app.app"]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uv run tries to sync again after uv sync --frozen --no-dev --no-install-project

this issue can be solved using the multi stage docker implementation

4 changes: 2 additions & 2 deletions app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import logging
from collections.abc import AsyncIterator
from contextlib import asynccontextmanager
from zoneinfo import ZoneInfo

import pytz
import uvicorn
from fastapi import BackgroundTasks, FastAPI
from fastapi.exceptions import RequestValidationError
Expand All @@ -20,7 +20,7 @@
from app.models import RequestModel, ResponseModel
from app.pesu import PESUAcademy

IST = pytz.timezone("Asia/Kolkata")
IST = ZoneInfo("Asia/Kolkata")
CSRF_TOKEN_REFRESH_INTERVAL_SECONDS = 45 * 60
CSRF_TOKEN_REFRESH_LOCK = asyncio.Lock()

Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ dependencies = [
"uvicorn>=0.27.0",
"httpx>=0.28.1",
"pydantic>=2.6.0",
"pytz>=2025.2",
"selectolax>=0.3.30",
]

Expand Down
36 changes: 17 additions & 19 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
# This file was autogenerated by uv via the following command:
# uv pip compile pyproject.toml
annotated-doc==0.0.4
# via fastapi
annotated-types==0.7.0
# via pydantic
anyio==4.9.0
anyio==4.13.0
# via
# httpx
# starlette
certifi==2025.7.14
certifi==2026.5.20
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

package uses uv.lock to install in new docker using uv sync --frozen --no-dev --no-install-project instead of requirements.xtxt

please run uv lock --upgrade

these packages will be upgraded to new versions:

anyio
certifi
click
fastapi
idna
pydantic
pydantic-core
selectolax
starlette
typing-extensions
typing-inspection
uvicorn
annotated-doc

# via
# httpcore
# httpx
click==8.2.1
click==8.4.0
# via uvicorn
fastapi==0.116.1
fastapi==0.136.1
# via pesu-auth (pyproject.toml)
h11==0.16.0
# via
Expand All @@ -22,33 +24,29 @@ httpcore==1.0.9
# via httpx
httpx==0.28.1
# via pesu-auth (pyproject.toml)
idna==3.10
idna==3.16
# via
# anyio
# httpx
pydantic==2.11.7
pydantic==2.13.4
# via
# pesu-auth (pyproject.toml)
# fastapi
pydantic-core==2.33.2
pydantic-core==2.46.4
# via pydantic
pytz==2025.2
# via pesu-auth (pyproject.toml)
selectolax==0.3.32
selectolax==0.4.9
# via pesu-auth (pyproject.toml)
sniffio==1.3.1
# via anyio
starlette==0.47.2
starlette==1.0.1
# via fastapi
typing-extensions==4.14.1
typing-extensions==4.15.0
# via
# anyio
# fastapi
# pydantic
# pydantic-core
# starlette
# typing-inspection
typing-inspection==0.4.1
# via pydantic
uvicorn==0.35.0
typing-inspection==0.4.2
# via
# fastapi
# pydantic
uvicorn==0.47.0
# via pesu-auth (pyproject.toml)
2 changes: 0 additions & 2 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading