Spaces:
Sleeping
Sleeping
File size: 584 Bytes
cf7f643 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | # Dockerfile — api_light_hf (FastAPI + Hugging Face Inference API)
FROM python:3.10-slim
# Non-root user (compatible with HF Spaces default)
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH \
PYTHONPATH=$HOME/app \
PYTHONUNBUFFERED=1
WORKDIR $HOME/app
COPY --chown=user . $HOME/app
RUN python -m pip install --upgrade pip \
&& pip install --no-cache-dir -r requirements.txt
# PORT is overridable via docker run -e PORT=8080
ENV PORT=7860
EXPOSE $PORT
CMD ["sh", "-c", "uvicorn app:app --host 0.0.0.0 --port ${PORT}"]
|