Commit
·
a82d18b
1
Parent(s):
fcd4ad7
Revise GPU Dockerfile
Browse files- Dockerfile.gpu +12 -15
Dockerfile.gpu
CHANGED
|
@@ -1,35 +1,32 @@
|
|
| 1 |
-
FROM nvidia/cuda:12.
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
ENV PYTHONDONTWRITEBYTECODE="1" \
|
| 4 |
PYTHONUNBUFFERED="1" \
|
| 5 |
DEBIAN_FRONTEND="noninteractive"
|
| 6 |
|
| 7 |
-
# Install
|
| 8 |
-
RUN apt-get update && \
|
| 9 |
-
apt-get install -y --no-install-recommends \
|
| 10 |
-
python3-pip \
|
| 11 |
-
python-is-python3 && \
|
| 12 |
-
apt-get clean && \
|
| 13 |
-
rm -rf /var/lib/apt/lists/*
|
| 14 |
-
|
| 15 |
-
# hadolint ignore=DL3013
|
| 16 |
-
RUN python3 -m pip install --no-cache-dir --upgrade pip setuptools wheel
|
| 17 |
-
|
| 18 |
WORKDIR /app/
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
# Download models during build instead of copying from local
|
| 21 |
COPY scripts/model_download.bash /tmp/model_download.bash
|
| 22 |
-
RUN
|
|
|
|
| 23 |
bash /tmp/model_download.bash && \
|
| 24 |
rm /tmp/model_download.bash
|
| 25 |
|
| 26 |
# Install CPU requirements
|
| 27 |
COPY requirements.cpu.txt ./
|
| 28 |
-
RUN
|
| 29 |
|
| 30 |
# Install GPU PyTorch requirements
|
| 31 |
COPY requirements.torch.gpu.txt ./
|
| 32 |
-
RUN
|
| 33 |
|
| 34 |
COPY app ./app
|
| 35 |
COPY main.py ./
|
|
|
|
| 1 |
+
FROM nvidia/cuda:12.6.3-cudnn-runtime-ubuntu24.04
|
| 2 |
+
|
| 3 |
+
# Install 'uv', which we will use to install Python dependencies
|
| 4 |
+
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
|
| 5 |
|
| 6 |
ENV PYTHONDONTWRITEBYTECODE="1" \
|
| 7 |
PYTHONUNBUFFERED="1" \
|
| 8 |
DEBIAN_FRONTEND="noninteractive"
|
| 9 |
|
| 10 |
+
# Install Python and create venv
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
WORKDIR /app/
|
| 12 |
+
RUN uv python install 3.12
|
| 13 |
+
RUN uv venv
|
| 14 |
+
RUN uv pip install --no-cache-dir --upgrade pip setuptools wheel
|
| 15 |
|
| 16 |
# Download models during build instead of copying from local
|
| 17 |
COPY scripts/model_download.bash /tmp/model_download.bash
|
| 18 |
+
RUN . .venv/bin/activate && \
|
| 19 |
+
uv pip install --no-cache-dir huggingface-hub && \
|
| 20 |
bash /tmp/model_download.bash && \
|
| 21 |
rm /tmp/model_download.bash
|
| 22 |
|
| 23 |
# Install CPU requirements
|
| 24 |
COPY requirements.cpu.txt ./
|
| 25 |
+
RUN uv pip install --no-cache-dir -r ./requirements.cpu.txt
|
| 26 |
|
| 27 |
# Install GPU PyTorch requirements
|
| 28 |
COPY requirements.torch.gpu.txt ./
|
| 29 |
+
RUN uv pip install --no-cache-dir -r ./requirements.torch.gpu.txt
|
| 30 |
|
| 31 |
COPY app ./app
|
| 32 |
COPY main.py ./
|