Infinite_Dockerized / Dockerfile
Carbaz's picture
Refactor Dockerfile to streamline build process and update INSTALL_TARGET configuration
78a89d3
Raw
History Blame Contribute Delete
1.07 kB
# Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
# you will also find guides on how best to write your Dockerfile
# Configuration
ARG GRADIO_REPO="https://github.com/Aarnonn/gradio.git"
ARG GRADIO_BRANCH="fix/fill-height-empty-footer-12992"
# Stage 1: Build frontend with Node 24
FROM node:24 AS builder
ARG GRADIO_REPO
ARG GRADIO_BRANCH
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
RUN npm install -g pnpm
# Clone and build Gradio
RUN git clone --branch ${GRADIO_BRANCH} ${GRADIO_REPO} /tmp/gradio
WORKDIR /tmp/gradio
RUN bash scripts/build_frontend.sh
# Stage 2: Runtime with Python
FROM python:3.13
ARG GRADIO_REPO
ARG GRADIO_BRANCH
ENV INSTALL_TARGET="${GRADIO_REPO}@${GRADIO_BRANCH}"
RUN useradd -m -u 1000 user
# Copy compiled Gradio from builder and install
COPY --from=builder /tmp/gradio /tmp/gradio
WORKDIR /tmp/gradio
RUN pip install --no-cache-dir --upgrade .
RUN rm -rf /tmp/gradio
USER user
ENV PATH="/home/user/.local/bin:$PATH"
WORKDIR /app
COPY --chown=user . /app
CMD ["python", "app.py"]