Spaces:
Sleeping
Sleeping
File size: 1,421 Bytes
4f01198 | 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 36 37 | # ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# PawCare Backend β Dockerfile for Hugging Face Spaces
# ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
FROM python:3.11-slim
# System deps for Pillow & psycopg2
RUN apt-get update && apt-get install -y --no-install-recommends \
libpq-dev gcc libjpeg-dev zlib1g-dev libwebp-dev \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Install Python deps first (layer cache)
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy project source
COPY . .
# Collect static files
RUN python manage.py collectstatic --noinput
# Create non-root user (HF Spaces runs as user 1000)
RUN useradd -m -u 1000 appuser && chown -R appuser:appuser /app
USER appuser
EXPOSE 7860
# Gunicorn: 2 workers Γ (2 Γ CPU + 1) threads β suitable for HF free tier
CMD ["gunicorn", "petcare.wsgi:application", \
"--bind", "0.0.0.0:7860", \
"--workers", "2", \
"--threads", "4", \
"--timeout", "120", \
"--access-logfile", "-", \
"--error-logfile", "-"]
|