FROM python:3.12-slim

ENV PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1
WORKDIR /srv

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

COPY app ./app

RUN useradd --uid 1000 --create-home hydro && mkdir -p /data && chown hydro /data
USER hydro

EXPOSE 8088
# One worker on purpose: SQLite has a single writer and the sync code keeps
# server_seq strictly ordered within one process.
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8088", "--workers", "1", "--proxy-headers"]
