skinscreen / Dockerfile
soleil-kamitto
fix: listen on port 7860 by default and run as non-root UID 1000 for Hugging Face Spaces
ad7b8b6
Raw
History Blame Contribute Delete
730 Bytes
FROM python:3.11-slim
RUN apt-get update && apt-get install -y --no-install-recommends \
libpq-dev gcc libgl1 libglib2.0-0 \
&& rm -rf /var/lib/apt/lists/*
# Hugging Face Spaces runs Docker containers as UID 1000 — create a matching
# user so the app can write the SQLite db and media/ uploads at runtime.
RUN useradd -m -u 1000 user
WORKDIR /app
RUN chown user:user /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY --chown=user app ./app
USER user
EXPOSE 7860
# Railway/other PaaS inject $PORT; Hugging Face Spaces doesn't, so this falls
# back to 7860 to match the app_port declared in README.md's Space metadata.
CMD uvicorn app.main:app --host 0.0.0.0 --port ${PORT:-7860}