File size: 953 Bytes
8dc6099 41e02f5 8dc6099 41e02f5 8dc6099 41e02f5 8dc6099 41e02f5 8dc6099 41e02f5 8dc6099 41e02f5 8dc6099 41e02f5 8dc6099 5ab02c3 41e02f5 5ab02c3 |
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 |
# Use Python 3.13.2 as the base image
FROM python:3.13.2-slim
# Install system dependencies as root first
RUN apt-get update && apt-get install -y \
gcc \
g++ \
curl \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Install uv
COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv
# Create user after system packages are installed
RUN useradd -m -u 1000 user
USER user
# Set home to the user's home directory
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
# Set the working directory
WORKDIR $HOME/app
# Copy pyproject.toml and uv.lock first to leverage Docker cache
COPY --chown=user:user pyproject.toml uv.lock ./
# Install Python dependencies using uv
RUN uv sync --frozen --no-dev
# Copy the application code
COPY --chown=user:user . $HOME/app
# Expose the port that Gradio will run on
EXPOSE 7860
# Use uv to run the application with module syntax
CMD ["uv", "run", "python", "-m", "src.gradio_app.app"] |