bpl-card-catalog / Dockerfile
davanstrien's picture
davanstrien HF Staff
Upload Dockerfile with huggingface_hub
51221f6 verified
raw
history blame contribute delete
745 Bytes
FROM python:3.11-slim
# Install uv from official image
COPY --from=ghcr.io/astral-sh/uv:0.9.30 /uv /bin/uv
ENV HF_XET_HIGH_PERFORMANCE=1
# Install dependencies — CPU-only torch via extra index
COPY requirements.in /tmp/requirements.in
RUN --mount=type=cache,target=/root/.cache/uv \
uv pip install --system \
--extra-index-url https://download.pytorch.org/whl/cpu \
-r /tmp/requirements.in
# Create non-root user (HF Spaces runs as user ID 1000)
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
WORKDIR $HOME/app
# Copy application
COPY --chown=user . .
# HF Spaces expects port 7860
EXPOSE 7860
CMD ["python", "app.py", "--from-hub", "--host", "0.0.0.0", "--port", "7860"]