Gopal2002's picture
Update Dockerfile (#11)
1a19cd1 verified
# ---------- BASE IMAGE ----------
FROM nvidia/cuda:12.2.0-devel-ubuntu22.04 AS base
# Set workdir inside container
WORKDIR /app
# Prevent interactive prompts
ENV DEBIAN_FRONTEND=noninteractive
# ---------- INSTALL DEPENDENCIES ----------
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
build-essential \
python3-pip \
python3-dev \
python3-venv \
ffmpeg \
libgl1 \
libglib2.0-0 \
&& rm -rf /var/lib/apt/lists/*
# ---------- COPY & INSTALL PYTHON DEPENDENCIES ----------
COPY requirements.txt .
RUN pip install --upgrade pip \
&& pip install --no-cache-dir -r requirements.txt
# ---------- COPY APP CODE ----------
COPY . .
# ---------- ENVIRONMENT VARIABLES ----------
ENV HF_HOME=/tmp/huggingface
ENV HF_HUB_CACHE=/tmp/huggingface/hub
ENV TRANSFORMERS_CACHE=/tmp/huggingface/transformers
ENV NVIDIA_VISIBLE_DEVICES=all
ENV NVIDIA_DRIVER_CAPABILITIES=compute,utility
# ---------- EXPOSE PORT ----------
EXPOSE 7860
# ---------- START APP ----------
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]