-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile.gpu
More file actions
46 lines (32 loc) · 1.23 KB
/
Copy pathDockerfile.gpu
File metadata and controls
46 lines (32 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# syntax=docker/dockerfile:1.7
# GPU variant of the NMT microservice (NLLB on CUDA).
# PyTorch cu118 wheels bundle CUDA 11.x libs via pip nvidia-* packages (no CUDA 12 runtime base).
FROM python:3.12-slim AS builder
WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
libc6-dev \
&& rm -rf /var/lib/apt/lists/*
COPY --from=shared . /tmp/dablja-worker
RUN pip install --no-cache-dir /tmp/dablja-worker
# Install CUDA-enabled PyTorch first so device probing sees the GPU at runtime.
RUN pip install --no-cache-dir --timeout 600 --retries 3 \
"torch==2.6.0+cu118" \
--index-url https://download.pytorch.org/whl/cu118
COPY requirements-base.txt .
RUN pip install --default-timeout=600 --retries=3 -r requirements-base.txt
COPY --from=docker_torch verify_gpu_torch.py /tmp/docker-torch/
ENV TORCH_CUDA_VERSION=2.6.0
RUN python /tmp/docker-torch/verify_gpu_torch.py
FROM python:3.12-slim
WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /usr/local /usr/local
COPY . .
RUN rm -f app/dablja_worker.py
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1
EXPOSE 8002
CMD ["python", "-m", "app.main"]