FROM python:3.11-slim

WORKDIR /app

ENV PYTHONDONTWRITEBYTECODE=1 \
    PYTHONUNBUFFERED=1

COPY pyproject.toml /app/pyproject.toml
COPY server /app/server
RUN pip install --no-cache-dir -U pip && pip install --no-cache-dir .

COPY frontend /app/frontend
COPY tools /app/tools
RUN python tools/build_frontend.py

COPY meds.yaml messages.yaml /app/

EXPOSE 8000

CMD ["uvicorn", "server.app:app", "--host", "0.0.0.0", "--port", "8000"]
