test-test / Dockerfile
heboya8's picture
Update Dockerfile
f3ad87e verified
raw
history blame
892 Bytes
# Use official Python slim image for a leaner base
FROM python:3.11-slim
# Set working directory
WORKDIR /app
# Copy requirements file first to leverage Docker cache
COPY requirements.txt .
# Update apt-get with retries and install system dependencies
RUN apt-get update --fix-missing && apt-get install -y --no-install-recommends \
gcc \
build-essential \
libpython3.11-dev \
&& rm -rf /var/lib/apt/lists/*
# Update pip and install pip-tools
RUN pip install --no-cache-dir --upgrade pip \
&& pip install --no-cache-dir pip-tools
# Sync dependencies with pip-sync
RUN pip-sync requirements.txt
# Install Gradio
RUN pip install --no-cache-dir gradio
# Copy the rest of the application code
COPY . .
# Expose Gradio default port
EXPOSE 7860
# Set environment variable to prevent Python buffering
ENV PYTHONUNBUFFERED=1
# Run the Gradio app
CMD ["python", "app.py"]