File size: 1,067 Bytes
0dfc197
 
 
78a89d3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0dfc197
 
78a89d3
 
 
0dfc197
 
78a89d3
 
 
 
 
 
 
0dfc197
 
 
 
 
91531b4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# 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"]