FROM nvidia/cuda:12.1.0-runtime-ubuntu22.04 | |
# Set working directory | |
WORKDIR /app | |
# Set environment variables | |
ENV DEBIAN_FRONTEND=noninteractive \ | |
PYTHONUNBUFFERED=1 \ | |
PYTHONDONTWRITEBYTECODE=1 | |
# Install system dependencies | |
RUN apt-get update && apt-get install -y --no-install-recommends \ | |
git \ | |
python3 \ | |
python3-pip \ | |
python3-setuptools \ | |
python3-dev \ | |
build-essential \ | |
&& apt-get clean \ | |
&& rm -rf /var/lib/apt/lists/* | |
# Copy requirements and install Python dependencies | |
COPY requirements.txt . | |
RUN pip3 install --no-cache-dir -r requirements.txt | |
# Copy application code | |
COPY . . | |
# Expose port for the application | |
EXPOSE 7860 | |
# Set default command | |
CMD ["python3", "app.py"] |