## Dockerfile FROM python:3.12-slim WORKDIR /app # Install Python dependencies + Gunicorn COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt \ && pip install --no-cache-dir gunicorn # Copy your application code COPY . . # (Optional) create a logs folder if you ever write files there RUN mkdir -p /tmp/logs # Spaces injects PORT (usually 7860); default to 7860 here ARG PORT=7860 ENV PORT=${PORT} # Tell Docker which port will be used EXPOSE ${PORT} # Launch via Gunicorn, binding to 0.0.0.0:$PORT CMD gunicorn app:app \ --bind 0.0.0.0:$PORT \ --workers 1 \ --timeout 120