# Use an official Python runtime as a parent image | |
FROM python:3.9 | |
# Install CUDA for GPU support (optional, based on your needs) | |
# Uncomment the following lines if you need GPU support | |
RUN apt-get update && apt-get install -y --no-install-recommends \ | |
cuda-cudart-dev-11.0 \ | |
&& \ | |
rm -rf /var/lib/apt/lists/* | |
# Set the working directory in the container | |
WORKDIR /app | |
# Copy the current directory contents into the container at /app | |
COPY . /app | |
# Install any needed packages specified in requirements.txt | |
RUN pip install --no-cache-dir -r requirements.txt | |
# Make port 7860 available to the world outside this container | |
EXPOSE 7860 | |
# Define environment variable for Gradio server port | |
ENV GRADIO_SERVER_PORT=7860 | |
# Run app.py when the container launches | |
CMD ["python", "app.py"] | |