FROM python:3.13-slim@sha256:168d3a5d10f2152f8e8d77b6843ac82c22a846cfefeef7afdf9aa630404e82a7

ENV PYTHONDONTWRITEBYTECODE=1

WORKDIR /app

COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

RUN useradd --create-home --shell /bin/bash appuser

COPY app/ app/
COPY schemas/ schemas/

COPY alembic.ini .
COPY alembic/ alembic/
RUN chown -R appuser:appuser /app/alembic
COPY scripts/ /app/scripts/

USER appuser

EXPOSE 8443

CMD ["python", "-m", "app.serve_tls"]

