Spaces:
Sleeping
Sleeping
File size: 748 Bytes
3e7ab24 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# syntax=docker/dockerfile:1
FROM python:3.11-slim
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1
WORKDIR /app
# System deps
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Install Python deps first (better caching)
COPY requirements.txt .
RUN pip install -r requirements.txt
# Copy app
COPY . .
# Hugging Face Spaces will provide PORT; default to 7860 locally
ENV PORT=7860
# Expose for local runs (HF ignores EXPOSE)
EXPOSE 7860
# Gunicorn config
ENV GUNICORN_CMD_ARGS="--workers=2 --threads=4 --timeout=120 --bind=0.0.0.0:${PORT}"
# Start server
CMD ["bash", "-lc", "exec gunicorn app:app"]
|