Files
akadmin 0e6506d97f Update state.json and development plan to reflect actual progress (~15%)
- state.json: Phase 5 status changed to pending, next steps updated
- DEVELOPMENT_PLAN.md v1.1: Added actual progress, verified current state,
  renumbered phases 5-9, marked all remaining work as PENDING
- Deleted outdated plans (BACKEND_TEST_PLAN, DATA_LOADING_VERIFICATION,
  DOCKER_MIGRATION_PLAN, ENDPOINT_AUDIT, ROADMAP, SIMPLIFICATION_PLAN,
  STATEMENT_OF_INTENT, backend/TEST_PLAN)
- Added new files: DEVELOPMENT_PLAN.md, backend/ARCHITECTURAL_REPORT.md,
  backend/SIMPLIFICATION_SUMMARY.md, backend/run.py, backend/.dockerignore
2026-08-27 04:41:30 +00:00

49 lines
1.2 KiB
Docker

# Multi-stage build for MTG Online Backend
# Stage 1: Install dependencies
FROM python:3.12-slim AS builder
WORKDIR /app
# Install build dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
libpq-dev \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements and install dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir --user -r requirements.txt
# Stage 2: Production image
FROM python:3.12-slim
WORKDIR /app
# Create non-root user
RUN groupadd -r appuser && useradd -r -g appuser -d /app -s /sbin/nologin appuser
# Copy dependencies from builder
COPY --from=builder /root/.local /root/.local
# Add local bin to PATH
ENV PATH=/root/.local/bin:$PATH
# Copy application code
COPY . .
# Set ownership
RUN chown -R appuser:appuser /app
# Switch to non-root user
USER appuser
# Expose port
EXPOSE 8000
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')" || exit 1
# Run the application
CMD ["python", "-m", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]