FROM python:3.12-slim
ENV PYTHONUNBUFFERED=1 PIP_NO_CACHE_DIR=1 DATA_DIR=/tmp/stitch-data
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY ms ./ms
COPY page ./page
COPY app.py stitch.py ./
# one worker: uploads, jobs and results live on this instance's disk; threads serve polling and downloads while a stitch runs
CMD exec gunicorn app:app --bind 0.0.0.0:${PORT:-8080} --workers 1 --threads 8 --timeout 900
