File size: 854 Bytes
0ee52bb |
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 |
# Use an official Python runtime as a parent image
FROM python:3.10-slim
# Set the working directory in the container
WORKDIR /app
# Install necessary system dependencies (kept minimal)
RUN apt-get update && \
apt-get install -y --no-install-recommends \
git \
libgl1 \
libglib2.0-0 \
&& rm -rf /var/lib/apt/lists/*
# Copy the requirements file first to leverage Docker cache
COPY requirements.txt ./
# Install Python packages
RUN pip install --no-cache-dir -r requirements.txt
# Copy the entire project
COPY . /app/
# Create a non-root user (HF Spaces requirement)
RUN useradd -m -u 1000 user
USER user
# Make sure the user owns the app directory
COPY --chown=user:user . /app/
# Expose Gradio default port
EXPOSE 7860
ENV PYTHONUNBUFFERED=1
# Run the app from the src/IDH directory
CMD ["python", "src/IDH/app_gradio.py"] |