FROM python:3.11-slim # Prevent python from buffering stdout/stderr ENV PYTHONUNBUFFERED=1 PIP_NO_CACHE_DIR=1 PORT=7860 WORKDIR /app COPY . /app # Install system deps if needed (kept minimal) RUN pip install -r requirements.txt # Expose the port used by Spaces EXPOSE 7860 # 1) Generate config files from secrets # 2) Launch the Flask app with gunicorn CMD bash -lc "python startup.py && gunicorn -w 2 -k gthread -b 0.0.0.0:${PORT} wsgi:app"