api_light_hf / Dockerfile
Renecto's picture
deploy api_light_hf (2026-03-12 12:47:03)
cf7f643
raw
history blame contribute delete
584 Bytes
# 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}"]