# Use the official Python slim image as the base image FROM python:3.12-slim # Set the working directory in the container WORKDIR /app # Update pip to the latest version RUN pip install --upgrade pip # Install build dependencies for compiling Python packages RUN apt-get update && apt-get install -y \ gcc \ g++ \ libffi-dev \ libssl-dev \ python3-dev \ && rm -rf /var/lib/apt/lists/* # Copy the requirements.txt file into the container COPY requirements.txt . # Verify that requirements.txt exists (for debugging) RUN ls -la /app && test -f /app/requirements.txt || (echo "Error: requirements.txt not found in /app" && exit 1) # Install Python dependencies from requirements.txt RUN pip install --no-cache-dir -r requirements.txt # Copy the application code into the container COPY . . # Expose the port Gradio will run on (default is 7860) EXPOSE 7860 # Command to run the Gradio app CMD ["python", "app.py"]