FROM python:3.9-slim WORKDIR /app COPY . /app ENV PYTHONUNBUFFERED=1 # install dependencies (ensure requirements.txt contains gunicorn) RUN pip install --no-cache-dir -r requirements.txt EXPOSE 7860 # Use shell form to allow ${PORT:-7860} expansion CMD ["sh", "-c", "gunicorn -w 1 -b 0.0.0.0:${PORT:-7860} app:app"]