# Use NVIDIA CUDA base image FROM nvidia/cuda:11.6.2-cudnn8-runtime-ubuntu20.04 # Set environment variables ENV PYTHONDONTWRITEBYTECODE=1 \ PYTHONUNBUFFERED=1 \ DEBIAN_FRONTEND=noninteractive # Install system dependencies RUN apt-get update && apt-get install -y \ python3-pip \ python3-dev \ curl \ libglib2.0-0 \ libsm6 \ libxrender1 \ libxext6 \ libfontconfig1 \ libgl1 \ && 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 pip3 install --no-cache-dir -r requirements.txt # Install PyTorch with CUDA support RUN pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu116 # Make port 8501 available to the world outside this container EXPOSE 8501 # Healthcheck to verify the application is running HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1 # Run app.py when the container launches CMD ["streamlit", "run", "--server.address", "0.0.0.0", "app.py"]