
FROM debian:bookworm

#  Install ALL required system dependencies in ONE layer
RUN apt-get update && apt-get install -y \
    python3 \
    python3-pip \
    python3-venv \
    potrace \
    fontforge \
    python3-fontforge \
    libgl1 \
    libglib2.0-0 \
    libxcb1 \
    libsm6 \
    libxext6 \
    && rm -rf /var/lib/apt/lists/*

# Set working directory
WORKDIR /code

# Copy requirements first (for Docker caching)
COPY requirements.txt .

# Install Python dependencies

RUN python3 -m pip install --break-system-packages --no-cache-dir --upgrade pip && \
    python3 -m pip install --break-system-packages --no-cache-dir -r requirements.txt

# Copy project
COPY . .

# Start FastAPI
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]