FROM python:3.11-slim

RUN apt-get update \
    && apt-get install -y --no-install-recommends imagemagick \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /app

COPY pyproject.toml .
COPY gallery/ gallery/
COPY tests/ tests/
COPY deploy/entrypoint.sh deploy/entrypoint.sh

RUN pip install --no-cache-dir ".[dev]"

RUN useradd -r -s /bin/false gallery
USER gallery

ENTRYPOINT ["gallery"]
CMD ["generate"]
