FROM python:3.12-slim-bookworm

ENV PYTHONDONTWRITEBYTECODE=1 \
    PYTHONUNBUFFERED=1

RUN apt-get update && apt-get install -y --no-install-recommends git docker.io ca-certificates && rm -rf /var/lib/apt/lists/*

WORKDIR /app

COPY pyproject.toml README.md /app/
COPY src /app/src
COPY alembic.ini /app/
COPY alembic /app/alembic
COPY docker/entrypoint.sh /app/docker/entrypoint.sh

RUN pip install --no-cache-dir .
RUN chmod +x /app/docker/entrypoint.sh

EXPOSE 8000
CMD ["/app/docker/entrypoint.sh"]
