offer / Dockerfile
clone3's picture
Create Dockerfile
542aa99 verified
raw
history blame contribute delete
634 Bytes
FROM python:3.11-slim
# Create user (very important for HF Spaces permissions)
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH \
PYTHONUNBUFFERED=1
WORKDIR $HOME/app
# Install dependencies first (better caching)
COPY --chown=user:user requirements.txt .
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
# Copy application code
COPY --chown=user:user . .
# Important: expose on port 7860!
# You can also set app_port: 8000 in README.md and change here to 8000
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]