# Use official lightweight Python base image
FROM python:3.11-slim

# Set working directory inside container
WORKDIR /app

# Install Python dependencies first to leverage Docker layer caching
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Copy application files
COPY . .

# Expose default port
EXPOSE 8000

# Set default environment variables
ENV PORT=8000
ENV USER_AGENT="Phikipathia/1.0 (Wikipedia Philosophy Path Visualizer; https://github.com/tdpeuter/2022ST-project-Phikipathia)"

# Run Python HTTP server
CMD ["python", "server.py"]
