fix: replace removed tiangolo base image with python:3.13-slim #115

Merged
cal merged 2 commits from fix/dockerfile-base-image into main 2026-04-09 12:51:58 +00:00
Owner

Summary

  • tiangolo/uvicorn-gunicorn-fastapi:python3.12 was removed from Docker Hub, breaking CI builds
  • Switches to python:3.13-slim with explicit uvicorn CMD
  • Fixes COPY path mismatch (was copying to /app/app with WORKDIR /usr/src/app)
  • Adds --workers 2 to replace the multi-worker gunicorn setup from the old base image

Follow-ups (not in this PR)

  • Remove vestigial WORKERS_PER_CORE/TIMEOUT/GRACEFUL_TIMEOUT env vars from docker-compose
  • Drop libpq-dev (not needed with psycopg2-binary)
  • Switch health check to /health endpoint
  • Add non-root user

Test plan

  • Merge, force-update dev tag, verify CI build succeeds
  • Pull :dev image on dev server and verify container starts
  • Hit /api/v3/current to confirm app is serving

🤖 Generated with Claude Code

## Summary - `tiangolo/uvicorn-gunicorn-fastapi:python3.12` was removed from Docker Hub, breaking CI builds - Switches to `python:3.13-slim` with explicit uvicorn CMD - Fixes COPY path mismatch (was copying to `/app/app` with WORKDIR `/usr/src/app`) - Adds `--workers 2` to replace the multi-worker gunicorn setup from the old base image ## Follow-ups (not in this PR) - Remove vestigial `WORKERS_PER_CORE`/`TIMEOUT`/`GRACEFUL_TIMEOUT` env vars from docker-compose - Drop `libpq-dev` (not needed with `psycopg2-binary`) - Switch health check to `/health` endpoint - Add non-root user ## Test plan - [ ] Merge, force-update `dev` tag, verify CI build succeeds - [ ] Pull `:dev` image on dev server and verify container starts - [ ] Hit `/api/v3/current` to confirm app is serving 🤖 Generated with [Claude Code](https://claude.com/claude-code)
cal added 1 commit 2026-04-09 11:50:03 +00:00
The tiangolo/uvicorn-gunicorn-fastapi:python3.12 image was removed from
Docker Hub, breaking CI builds. Switches to official python:3.13-slim
with explicit uvicorn CMD. Fixes COPY path to match WORKDIR and adds
2 workers to replace the multi-worker gunicorn setup.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Claude added the
ai-reviewing
label 2026-04-09 12:15:50 +00:00
Claude requested changes 2026-04-09 12:17:46 +00:00
Claude left a comment
Collaborator

AI Code Review

Files Reviewed

  • Dockerfile (modified)

Findings

Correctness

Blocking: numpy==1.26.4 has no Python 3.13 wheel.

requirements.txt pins numpy==1.26.4, which supports Python 3.9–3.12 only. NumPy 3.13 support was introduced in 2.1.0. On python:3.13-slim:

  • pip will find no pre-built wheel for numpy==1.26.4 + Python 3.13
  • slim images ship no C build toolchain (no gcc/build-essential), so source compilation will also fail
  • Result: docker build fails at pip install -r requirements.txt — the CI break this PR intends to fix persists, just with a different error

psycopg2-binary==2.9.11 may also lack a Python 3.13 wheel depending on the target arch/platform, though this is secondary to the numpy issue.

Fix: Change python:3.13-slimpython:3.12-slim. This matches the Python version from the removed tiangolo/uvicorn-gunicorn-fastapi:python3.12 base image and requires no changes to requirements.txt. Upgrading to 3.13 is a separate task that would require updating numpy (≥2.1) and verifying all other pinned deps.

Security

  • No issues found.

Style & Conventions

  • Everything else in the diff is correct:
    • COPY ./app /usr/src/app/app properly aligns the copy destination with WORKDIR /usr/src/app, fixing the pre-existing path mismatch.
    • CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "80", "--workers", "2"] is correct — app.main:app resolves to /usr/src/app/app/main.pyapp = FastAPI(...) at line 65.
    • --workers 2 is safe here because Peewee's autoconnect=False (PR #87) ensures connections are not established before fork.

Suggestions

  • The follow-ups listed in the PR body (remove vestigial env vars, drop libpq-dev, non-root user) are well-scoped — good to track separately.
  • Consider python:3.12-slim as the final image name to signal the Python version explicitly, or add a comment noting why 3.13 was not used yet.

Verdict: REQUEST_CHANGES

The only change needed is python:3.13-slimpython:3.12-slim in Dockerfile line 2. All other changes (COPY path fix, explicit CMD) are correct and should be kept.


Automated review by Claude PR Reviewer

## AI Code Review ### Files Reviewed - `Dockerfile` (modified) ### Findings #### Correctness **Blocking: `numpy==1.26.4` has no Python 3.13 wheel.** `requirements.txt` pins `numpy==1.26.4`, which supports Python 3.9–3.12 only. NumPy 3.13 support was introduced in 2.1.0. On `python:3.13-slim`: - pip will find no pre-built wheel for `numpy==1.26.4` + Python 3.13 - `slim` images ship no C build toolchain (no `gcc`/`build-essential`), so source compilation will also fail - Result: `docker build` fails at `pip install -r requirements.txt` — the CI break this PR intends to fix persists, just with a different error `psycopg2-binary==2.9.11` may also lack a Python 3.13 wheel depending on the target arch/platform, though this is secondary to the numpy issue. **Fix:** Change `python:3.13-slim` → `python:3.12-slim`. This matches the Python version from the removed `tiangolo/uvicorn-gunicorn-fastapi:python3.12` base image and requires no changes to `requirements.txt`. Upgrading to 3.13 is a separate task that would require updating numpy (≥2.1) and verifying all other pinned deps. #### Security - No issues found. #### Style & Conventions - Everything else in the diff is correct: - `COPY ./app /usr/src/app/app` properly aligns the copy destination with `WORKDIR /usr/src/app`, fixing the pre-existing path mismatch. - `CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "80", "--workers", "2"]` is correct — `app.main:app` resolves to `/usr/src/app/app/main.py` → `app = FastAPI(...)` at line 65. - `--workers 2` is safe here because Peewee's `autoconnect=False` (PR #87) ensures connections are not established before fork. #### Suggestions - The follow-ups listed in the PR body (remove vestigial env vars, drop `libpq-dev`, non-root user) are well-scoped — good to track separately. - Consider `python:3.12-slim` as the final image name to signal the Python version explicitly, or add a comment noting why 3.13 was not used yet. ### Verdict: REQUEST_CHANGES The only change needed is `python:3.13-slim` → `python:3.12-slim` in `Dockerfile` line 2. All other changes (COPY path fix, explicit CMD) are correct and should be kept. --- *Automated review by Claude PR Reviewer*
Claude added
ai-changes-requested
and removed
ai-reviewing
labels 2026-04-09 12:18:02 +00:00
Claude added the
ai-working
label 2026-04-09 12:30:50 +00:00
cal added 1 commit 2026-04-09 12:31:23 +00:00
numpy==1.26.4 has no Python 3.13 wheel and slim images have no build
toolchain, so the build would fail. python:3.12-slim matches the Python
version from the removed tiangolo base image.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Collaborator

Addressed review feedback: changed python:3.13-slimpython:3.12-slim.

numpy==1.26.4 (pinned in requirements.txt) has no Python 3.13 wheel, and the slim image ships no C build toolchain, so the build would have failed at pip install. python:3.12-slim matches the Python version from the removed tiangolo base image and requires no changes to requirements.txt.

Addressed review feedback: changed `python:3.13-slim` → `python:3.12-slim`. `numpy==1.26.4` (pinned in requirements.txt) has no Python 3.13 wheel, and the slim image ships no C build toolchain, so the build would have failed at `pip install`. `python:3.12-slim` matches the Python version from the removed tiangolo base image and requires no changes to requirements.txt.
Claude removed the
ai-working
ai-changes-requested
labels 2026-04-09 12:31:52 +00:00
Claude added the
ai-reviewing
label 2026-04-09 12:45:49 +00:00
Claude reviewed 2026-04-09 12:46:51 +00:00
Claude left a comment
Collaborator

AI Code Review

Files Reviewed

  • Dockerfile (modified)

Findings

Correctness

  • No issues found.
  • FROM python:3.12-slim is correct. numpy==1.26.4 has no Python 3.13 wheel, so 3.12 is the right target. (PR title says "3.13-slim" but the actual diff uses 3.12-slim — stale title, correct code.)
  • COPY ./app /usr/src/app/app correctly places app code at /usr/src/app/app/ which aligns with WORKDIR /usr/src/app and resolves app.main:app in the CMD. Verified: app/main.py:65 declares app = FastAPI(...).
  • CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "80", "--workers", "2"] is required since python:3.12-slim has no built-in entrypoint; correctly replaces gunicorn's multi-worker behavior.

Security

  • No issues found. No secrets or credentials introduced.

Style & Conventions

  • PR title references python:3.13-slim but the implemented change is python:3.12-slim. Functionally correct; title is just stale.

Suggestions

  • The follow-ups listed in the PR body (libpq-dev removal, /health healthcheck, non-root user) are all valid — worth tracking as issues if not already.

Verdict: COMMENT

Code is correct. COPY path fix and explicit CMD are both sound. Approved — posting as COMMENT because Gitea blocks self-approval.


Automated review by Claude PR Reviewer

## AI Code Review ### Files Reviewed - `Dockerfile` (modified) ### Findings #### Correctness - No issues found. - `FROM python:3.12-slim` is correct. `numpy==1.26.4` has no Python 3.13 wheel, so 3.12 is the right target. (PR title says "3.13-slim" but the actual diff uses 3.12-slim — stale title, correct code.) - `COPY ./app /usr/src/app/app` correctly places app code at `/usr/src/app/app/` which aligns with `WORKDIR /usr/src/app` and resolves `app.main:app` in the CMD. Verified: `app/main.py:65` declares `app = FastAPI(...)`. - `CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "80", "--workers", "2"]` is required since `python:3.12-slim` has no built-in entrypoint; correctly replaces gunicorn's multi-worker behavior. #### Security - No issues found. No secrets or credentials introduced. #### Style & Conventions - PR title references `python:3.13-slim` but the implemented change is `python:3.12-slim`. Functionally correct; title is just stale. #### Suggestions - The follow-ups listed in the PR body (`libpq-dev` removal, `/health` healthcheck, non-root user) are all valid — worth tracking as issues if not already. ### Verdict: COMMENT Code is correct. COPY path fix and explicit CMD are both sound. Approved — posting as COMMENT because Gitea blocks self-approval. --- *Automated review by Claude PR Reviewer*
Claude added the
ai-reviewed
label 2026-04-09 12:47:06 +00:00
cal merged commit 1df1abbd7c into main 2026-04-09 12:51:58 +00:00
cal deleted branch fix/dockerfile-base-image 2026-04-09 12:51:58 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: cal/major-domo-database#115
No description provided.