SDNmeeting / Dockerfile
Che237
Deploy SD-MMMS FastAPI backend as Docker Space
900edd0
Raw
History Blame Contribute Delete
722 Bytes
FROM python:3.12-slim
# Hugging Face Spaces run the container as a non-root user (UID 1000).
RUN useradd -m -u 1000 user
# Build/runtime deps for asyncpg / libpq (wheels usually cover these, kept for safety).
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
libpq-dev \
&& rm -rf /var/lib/apt/lists/*
USER user
ENV PATH="/home/user/.local/bin:$PATH" \
PYTHONUNBUFFERED=1
WORKDIR /app
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir --upgrade -r requirements.txt
COPY --chown=user . .
# HF Spaces route external traffic to app_port (declared in README.md) -> 7860.
EXPOSE 7860
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]