Chattr / Dockerfile
MH0386's picture
Upload folder using huggingface_hub
2a28594 verified
raw
history blame
1.35 kB
FROM python:3.13@sha256:5f69d22a88dd4cc4ee1576def19aef48c8faa1b566054c44291183831cbad13b AS builder
SHELL ["/bin/bash", "-c"]
ENV UV_LINK_MODE=copy \
UV_COMPILE_BYTECODE=1 \
UV_PYTHON_DOWNLOADS=0
COPY --from=ghcr.io/astral-sh/uv:latest@sha256:68a26194ea8da0dbb014e8ae1d8ab08a469ee3ba0f4e2ac07b8bb66c0f8185c1 \
/uv /uvx /bin/
WORKDIR /app
RUN --mount=type=cache,target=/root/.cache/uv \
--mount=type=bind,source=uv.lock,target=uv.lock \
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
--mount=type=bind,source=README.md,target=README.md \
uv sync --no-install-project --no-dev --locked --no-editable
COPY . /app
RUN --mount=type=cache,target=/root/.cache/uv \
uv sync --no-dev --locked --no-editable
FROM python:3.13-slim@sha256:f2fdaec50160418e0c2867ba3e254755edd067171725886d5d303fd7057bbf81 AS production
SHELL ["/bin/bash", "-c"]
ENV GRADIO_SERVER_PORT=7860 \
GRADIO_SERVER_NAME=0.0.0.0
RUN groupadd app && \
useradd -m -g app -s /bin/bash app && \
apt-get update > /dev/null && \
apt-get install -y --no-install-recommends curl > /dev/null && \
apt-get clean > /dev/null && \
rm -rf /var/lib/apt/lists/*
WORKDIR /home/app
COPY --from=builder --chown=app:app --chmod=555 /app/.venv /app/.venv
USER app
EXPOSE ${GRADIO_SERVER_PORT}
CMD ["/app/.venv/bin/chattr"]