# Dockerfile for SWIPER image-swipe application
# ------------------------------------------------
# This image runs the built-in Python HTTP server provided by server.py.
# Pillow needs system libs so we install them via apt.

FROM python:3.11-slim

# Install system packages required by Pillow (JPEG, zlib)
RUN apt-get update \
    && apt-get install -y --no-install-recommends build-essential libjpeg-dev zlib1g-dev \
    && rm -rf /var/lib/apt/lists/*

# Set work directory
WORKDIR /app

# Install Python dependencies first (leverages Docker layer caching)
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt

# Copy application source
COPY . .

# Expose the default port
EXPOSE 8888

# Start the server
CMD ["python", "server.py"]
