V-Express / Dockerfile
quantumos's picture
Update Dockerfile
ef3c14e verified
Raw History Blame Contribute Delete
1.52 kB
# Use an official CUDA runtime as a parent image
FROM nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu20.04
# Set environment variables
ENV DEBIAN_FRONTEND=noninteractive
# Install necessary system dependencies
RUN apt-get update && apt-get install -y \
cmake \
libsm6 \
libxext6 \
libglib2.0-0 \
libxrender-dev \
libgl1-mesa-glx \
build-essential \
g++ \
python3-pip \
python3-dev \
&& rm -rf /var/lib/apt/lists/*
# Reset noninteractive mode
ENV DEBIAN_FRONTEND=
# Set cache directories for transformers and matplotlib
ENV TRANSFORMERS_CACHE=/app/.cache/huggingface/hub
ENV MPLCONFIGDIR=/app/.cache/matplotlib
ENV XDG_CACHE_HOME=/app/.cache
ENV FONTCONFIG_PATH=/app/.cache/fontconfig
RUN mkdir -p /app/.cache/huggingface/hub /app/.cache/matplotlib /app/.cache/fontconfig
# Set working directory
WORKDIR /app
# Copy the requirements file
COPY requirements.txt .
# Install pip and upgrade it
RUN pip install --upgrade pip
# Install dependencies from requirements.txt
RUN pip install -r requirements.txt
# Install torch, torchvision, and torchaudio with the specified extra index URL
RUN pip install torch==2.0.1+cu118 torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu118
# Ensure the application is run as a non-root user
RUN adduser --disabled-password --gecos '' appuser && chown -R appuser /app
USER appuser
# Copy the rest of the application code
COPY . .
# Expose the port
EXPOSE 7860
# Command to run the app
CMD ["python3", "app.py"]