ARG PYTHON_IMAGE=python:3.12-slim
FROM ${PYTHON_IMAGE}

WORKDIR /app
COPY backend/requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY backend/app.py .
COPY backend/gunicorn.conf.py .
COPY frontend ./static

RUN mkdir -p /data
ENV PORT=5000 BD_SECRET_FILE=/data/secret.bin
EXPOSE 5000

CMD ["gunicorn", "--config", "gunicorn.conf.py", "-w", "1", "--threads", "16", "-k", "gthread", \
     "--timeout", "30", "-b", "0.0.0.0:5000", "app:app"]
