37 lines
1.0 KiB
Docker
37 lines
1.0 KiB
Docker
FROM nvidia/cuda:12.4.1-cudnn-runtime-ubuntu22.04
|
|
|
|
# Prevent interactive prompts during install
|
|
ENV DEBIAN_FRONTEND=noninteractive
|
|
|
|
# Install system dependencies
|
|
RUN apt-get update && apt-get install -y \
|
|
python3 \
|
|
python3-pip \
|
|
curl \
|
|
git \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
WORKDIR /app
|
|
|
|
# Install PyTorch with CUDA 12.4 support FIRST (before requirements.txt)
|
|
# Default pip installs CPU-only PyTorch - must use pytorch.org index for GPU support
|
|
RUN --mount=type=cache,target=/root/.cache/pip \
|
|
pip3 install torch torchvision --index-url https://download.pytorch.org/whl/cu124
|
|
|
|
# Install remaining Python dependencies (torch/torchvision already satisfied, with pip cache)
|
|
COPY requirements.txt /app/
|
|
RUN --mount=type=cache,target=/root/.cache/pip \
|
|
pip3 install -r requirements.txt
|
|
|
|
COPY app.py /app/
|
|
|
|
# Default environment variables
|
|
ENV CLIP_MODEL=ViT-B/32
|
|
|
|
EXPOSE 5006
|
|
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=30s --retries=3 \
|
|
CMD curl -f http://localhost:5006/health || exit 1
|
|
|
|
CMD ["python3", "app.py"]
|