Dakoro's picture
feat: add dockerfile
e1f8360
Raw
History Blame Contribute Delete
713 Bytes
FROM python:3.12-slim
# Install uv (single static binary)
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
# HF Spaces runs containers as user 1000 — set up matching home and workdir
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH \
UV_LINK_MODE=copy \
UV_COMPILE_BYTECODE=1
WORKDIR /home/user/app
# Install deps first for better layer caching
COPY --chown=user pyproject.toml uv.lock* ./
RUN uv sync --frozen --no-dev 2>/dev/null || uv sync --no-dev
# Copy app code + data + pre-trained models
COPY --chown=user . .
ENV GRADIO_SERVER_NAME=0.0.0.0 \
GRADIO_SERVER_PORT=7860
EXPOSE 7860
CMD ["uv", "run", "--no-dev", "python", "app.py"]