API / Dockerfile
Rox-Turbo's picture
Update Dockerfile
19d468d verified
raw
history blame
572 Bytes
FROM python:3.11-slim
WORKDIR /app
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1
# Install dependencies first (better caching)
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy application code
COPY . .
# Hugging Face Spaces runs as user 1000
RUN useradd -m -u 1000 user
USER user
# Set PATH for user
ENV PATH="/home/user/.local/bin:$PATH"
# Expose port 7860 (Hugging Face Spaces default)
EXPOSE 7860
# Start server on port 7860 for Hugging Face Spaces
CMD ["uvicorn", "server:app", "--host", "0.0.0.0", "--port", "7860"]