Text-Api / Dockerfile
um41r's picture
Upload Dockerfile
b59455e verified
raw
history blame contribute delete
571 Bytes
FROM python:3.11-slim
# HuggingFace Spaces runs as user 1000
RUN useradd -m -u 1000 user
WORKDIR /app
# System deps
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential curl && \
rm -rf /var/lib/apt/lists/*
# Install Python deps as root first (faster layer caching)
COPY --chown=user requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy app source
COPY --chown=user . .
# HF Spaces exposes port 7860
ENV PORT=7860
EXPOSE 7860
USER user
CMD ["uvicorn", "api:app", "--host", "0.0.0.0", "--port", "7860"]