From 6d1bc77e387d5cb0255c43ac75bf423b91fde65a Mon Sep 17 00:00:00 2001 From: Cal Corum Date: Tue, 4 Nov 2025 09:19:30 -0600 Subject: [PATCH] CLAUDE: Fix Docker build for UV migration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed Docker build issues to complete UV migration. ## Changes ### README.md - Created backend README.md (required by hatchling build system) - Simple quick start guide referencing CLAUDE.md ### Dockerfile - Added `build-essential` for compiling native extensions (pendulum Rust code) - Updated copy steps to include README.md in both dev and prod stages - Dockerfile now successfully builds both development and production images ### .dockerignore - Added exception `!README.md` to allow README.md through - Keeps other *.md files excluded as intended ## Testing - ✅ Development image builds successfully (paper-dynasty-backend:dev-uv) - ✅ Production image builds successfully (paper-dynasty-backend:prod-uv) - ✅ Container starts and UV installs dependencies correctly - ✅ Application attempts to start (fails only on missing .env, as expected) ## Build Results - Dev image: 73 packages installed (with dev deps) - Prod image: 57 packages installed (no dev deps) - Both stages use `uv sync --frozen` for reproducible builds - Build time: ~1-2 minutes per stage 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- backend/.dockerignore | 1 + backend/Dockerfile | 9 +++++---- backend/README.md | 20 ++++++++++++++++++++ 3 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 backend/README.md diff --git a/backend/.dockerignore b/backend/.dockerignore index 6e64de2..e8b62b8 100644 --- a/backend/.dockerignore +++ b/backend/.dockerignore @@ -44,6 +44,7 @@ docker-compose.yml # Documentation *.md +!README.md docs/ # OS diff --git a/backend/Dockerfile b/backend/Dockerfile index 1e5104a..f8aba3c 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -14,6 +14,7 @@ ENV PYTHONUNBUFFERED=1 \ RUN apt-get update && apt-get install -y \ curl \ postgresql-client \ + build-essential \ && rm -rf /var/lib/apt/lists/* # Install UV @@ -25,8 +26,8 @@ WORKDIR /app # Development stage FROM base as development -# Copy dependency files -COPY pyproject.toml uv.lock ./ +# Copy dependency files (including README.md referenced in pyproject.toml) +COPY pyproject.toml uv.lock README.md ./ # Install all dependencies (including dev) RUN uv sync --frozen @@ -43,8 +44,8 @@ CMD ["uv", "run", "python", "-m", "uvicorn", "app.main:socket_app", "--host", "0 # Production stage FROM base as production -# Copy dependency files -COPY pyproject.toml uv.lock ./ +# Copy dependency files (including README.md referenced in pyproject.toml) +COPY pyproject.toml uv.lock README.md ./ # Install production dependencies only RUN uv sync --frozen --no-dev diff --git a/backend/README.md b/backend/README.md new file mode 100644 index 0000000..d98a2cd --- /dev/null +++ b/backend/README.md @@ -0,0 +1,20 @@ +# Paper Dynasty Backend + +FastAPI-based real-time baseball game engine with WebSocket support. + +## Quick Start + +```bash +# Install UV +curl -LsSf https://astral.sh/uv/install.sh | sh + +# Install dependencies +uv sync + +# Run server +uv run python -m app.main +``` + +## Documentation + +See `CLAUDE.md` for full documentation.