Implements schedule viewing from SBA production API with week navigation and game creation from scheduled matchups. Groups games by team matchup horizontally with games stacked vertically for space efficiency. Backend: - Add schedule routes (/api/schedule/current, /api/schedule/games) - Add SBA API client methods for schedule data - Fix multi-worker state isolation (single worker for in-memory state) - Add Redis migration TODO for future scalability - Support custom team IDs in quick-create endpoint Frontend: - Add Schedule tab as default on home page - Week navigation with prev/next and "Current Week" jump - Horizontal group layout (2-6 columns responsive) - Completed games show score + "Final" badge (no Play button) - Incomplete games show "Play" button to create webapp game Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
73 lines
1.9 KiB
Docker
73 lines
1.9 KiB
Docker
# Backend Dockerfile for Paper Dynasty Game Engine
|
|
# Multi-stage build for optimized production image
|
|
|
|
FROM python:3.13-slim as base
|
|
|
|
# Set environment variables
|
|
ENV PYTHONUNBUFFERED=1 \
|
|
PYTHONDONTWRITEBYTECODE=1 \
|
|
UV_LINK_MODE=copy \
|
|
UV_COMPILE_BYTECODE=1 \
|
|
UV_PYTHON_DOWNLOADS=never
|
|
|
|
# Install system dependencies and UV
|
|
RUN apt-get update && apt-get install -y \
|
|
curl \
|
|
postgresql-client \
|
|
build-essential \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Install UV
|
|
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
|
|
|
|
# Create app directory
|
|
WORKDIR /app
|
|
|
|
# Development stage
|
|
FROM base as development
|
|
|
|
# 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
|
|
|
|
# Copy application code
|
|
COPY . .
|
|
|
|
# Expose port
|
|
EXPOSE 8000
|
|
|
|
# Run with uvicorn reload for development
|
|
CMD ["uv", "run", "python", "-m", "uvicorn", "app.main:socket_app", "--host", "0.0.0.0", "--port", "8000", "--reload"]
|
|
|
|
# Production stage
|
|
FROM base as production
|
|
|
|
# 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
|
|
|
|
# Create non-root user
|
|
RUN useradd -m -u 1000 appuser && \
|
|
chown -R appuser:appuser /app
|
|
|
|
# Copy application code
|
|
COPY --chown=appuser:appuser . .
|
|
|
|
# Switch to non-root user
|
|
USER appuser
|
|
|
|
# Expose port
|
|
EXPOSE 8000
|
|
|
|
# Health check
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
|
CMD curl -f http://localhost:8000/api/health || exit 1
|
|
|
|
# Run with production server
|
|
# NOTE: Using single worker because in-memory state_manager cannot be shared across workers.
|
|
# Multiple workers would require Redis or another shared state store.
|
|
CMD ["uv", "run", "python", "-m", "uvicorn", "app.main:socket_app", "--host", "0.0.0.0", "--port", "8000", "--workers", "1"] |