fix: Dockerfile COPY path and missing CMD #101

Merged
cal merged 2 commits from fix/dockerfile-copy-cmd into main 2026-03-17 20:29:34 +00:00
Owner

Problem

Container is crash-looping after the 2026.3.17 release. Root cause: the Dockerfile optimization introduced two bugs:

  1. COPY ./app /app/app — wrong destination path, doesn't match WORKDIR /usr/src/app. App code never lands in the working directory.
  2. No CMD — container inherits python3 (no-op) from the Python base image and exits immediately with code 0.

Fix

  • COPY ./app /app/appCOPY ./app /usr/src/app/app
  • Added CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "80"]
## Problem Container is crash-looping after the 2026.3.17 release. Root cause: the Dockerfile optimization introduced two bugs: 1. `COPY ./app /app/app` — wrong destination path, doesn't match `WORKDIR /usr/src/app`. App code never lands in the working directory. 2. No `CMD` — container inherits `python3` (no-op) from the Python base image and exits immediately with code 0. ## Fix - `COPY ./app /app/app` → `COPY ./app /usr/src/app/app` - Added `CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "80"]`
cal added 1 commit 2026-03-17 20:06:04 +00:00
fix: correct COPY path and add CMD in Dockerfile
Some checks failed
Build Docker Image / build (pull_request) Failing after 56s
d8d1b2ac2f
- COPY ./app /app/app → /usr/src/app/app (matches WORKDIR)
- Add CMD for uvicorn startup (was missing, inheriting python3 no-op from base image)
cal added 1 commit 2026-03-17 20:09:08 +00:00
fix: correct COPY path and add CMD in Dockerfile
All checks were successful
Build Docker Image / build (pull_request) Successful in 7m54s
d0c4bd3bbd
- COPY ./app /app/app → /usr/src/app/app (matches WORKDIR)
- Add CMD for uvicorn startup (was missing, inheriting python3 no-op from base image)
Claude added the
ai-reviewing
label 2026-03-17 20:15:52 +00:00
Claude approved these changes 2026-03-17 20:17:40 +00:00
Claude left a comment
Collaborator

AI Code Review

Files Reviewed

  • Dockerfile (modified)

Findings

Correctness

  • COPY path fix is correct. WORKDIR /usr/src/app means pip and playwright installs land there. For uvicorn app.main:app to resolve the module, the app package must be at /usr/src/app/app/. The old COPY ./app /app/app placed it at the wrong path entirely.
  • CMD is correct. uvicorn app.main:app --host 0.0.0.0 --port 80 runs from WORKDIR /usr/src/app, resolving app.main to /usr/src/app/app/main.py. Port 80 matches the expected container port (mapped to 815 in prod).
  • Minor PR body inaccuracy. The body says "inherits python3 (no-op) from the Python base image." The actual base image is tiangolo/uvicorn-gunicorn-fastapi:latest, which has its own CMD (/start.sh running gunicorn) — not a no-op Python shell. However, the original COPY path was wrong regardless, so that CMD would also have failed with a ModuleNotFoundError. The fix outcome is correct either way.

Security

  • No issues. No credentials, no user input, no secrets.

Style & Conventions

  • No issues. Single focused change, matches fix/ branch naming convention.

Suggestions

  • gunicorn → plain uvicorn regression (low priority): The original base image CMD ran gunicorn with multiple uvicorn workers (auto-respawn on worker crash, multi-process). The new explicit CMD uses single-worker uvicorn. This is acceptable as a hotfix — getting the container running is the priority — but consider restoring a multi-worker setup (e.g. --workers 4) or switching to a plainer Python base image and running gunicorn explicitly in a follow-up.

Verdict: APPROVED

Both fixes are correct and necessary. The COPY path aligns with WORKDIR, and the CMD provides the explicit entrypoint needed. Minor: PR description misstates the base image's inherited CMD, but this doesn't affect the fix.


Automated review by Claude PR Reviewer

## AI Code Review ### Files Reviewed - `Dockerfile` (modified) ### Findings #### Correctness - **COPY path fix is correct.** `WORKDIR /usr/src/app` means pip and playwright installs land there. For `uvicorn app.main:app` to resolve the module, the app package must be at `/usr/src/app/app/`. The old `COPY ./app /app/app` placed it at the wrong path entirely. - **CMD is correct.** `uvicorn app.main:app --host 0.0.0.0 --port 80` runs from `WORKDIR /usr/src/app`, resolving `app.main` to `/usr/src/app/app/main.py`. Port 80 matches the expected container port (mapped to 815 in prod). - **Minor PR body inaccuracy.** The body says "inherits `python3` (no-op) from the Python base image." The actual base image is `tiangolo/uvicorn-gunicorn-fastapi:latest`, which has its own CMD (`/start.sh` running gunicorn) — not a no-op Python shell. However, the original COPY path was wrong regardless, so that CMD would also have failed with a ModuleNotFoundError. The fix outcome is correct either way. #### Security - No issues. No credentials, no user input, no secrets. #### Style & Conventions - No issues. Single focused change, matches `fix/` branch naming convention. #### Suggestions - **gunicorn → plain uvicorn regression (low priority):** The original base image CMD ran gunicorn with multiple uvicorn workers (auto-respawn on worker crash, multi-process). The new explicit CMD uses single-worker uvicorn. This is acceptable as a hotfix — getting the container running is the priority — but consider restoring a multi-worker setup (e.g. `--workers 4`) or switching to a plainer Python base image and running gunicorn explicitly in a follow-up. ### Verdict: APPROVED Both fixes are correct and necessary. The COPY path aligns with WORKDIR, and the CMD provides the explicit entrypoint needed. Minor: PR description misstates the base image's inherited CMD, but this doesn't affect the fix. --- *Automated review by Claude PR Reviewer*
Claude added
ai-reviewed
and removed
ai-reviewing
labels 2026-03-17 20:18:05 +00:00
cal merged commit dcf9036140 into main 2026-03-17 20:29:34 +00:00
Sign in to join this conversation.
No description provided.