Spaces:
Sleeping
Sleeping
File size: 736 Bytes
5cbd85c e7112a8 5cbd85c e7112a8 5cbd85c e7112a8 5cbd85c e7112a8 5cbd85c e7112a8 | 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 | # Use a stable Python 3.11 base image
FROM python:3.11-slim
# Install system dependencies as root
RUN apt-get update && apt-get install -y \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Set the working directory
WORKDIR /app
# Copy requirements first to leverage Docker cache
COPY requirements.txt .
# Install Python packages as root into the system path
RUN pip install --no-cache-dir -r requirements.txt
# Create a non-root user for security (HF requirement)
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH
# Copy the rest of the app files as the new user
COPY --chown=user . .
# Expose the mandatory Gradio port
EXPOSE 7860
# Run the app
CMD ["python", "app.py"] |