Skip to content

Commit 0bceaae

Browse files
fix: Add CUDA_DEVEL_TAG for development image and update Dockerfile for GPU build with JIT driver
1 parent 7628f19 commit 0bceaae

File tree

2 files changed

+14
-29
lines changed

2 files changed

+14
-29
lines changed

.github/workflows/publish.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ jobs:
5656
PY_VER=3.10
5757
TF_VER=2.9.2
5858
CUDA_TAG=11.8.0-cudnn8-runtime-ubuntu22.04
59+
CUDA_DEVEL_TAG=11.8.0-cudnn8-devel-ubuntu22.04
5960
# 4. Multi-arch CPU image
6061
- name: Build and push CPU Docker image
6162
uses: docker/build-push-action@v6

Dockerfile.pb

Lines changed: 13 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,9 @@
44

55
ARG PY_VER=3.10
66
ARG TF_VER=2.9.2
7-
ARG BUILD_TYPE=gpu
7+
ARG BUILD_TYPE=cpu
88
ARG CUDA_TAG=11.8.0-cudnn8-runtime-ubuntu22.04
9-
10-
# ==============================================================================
11-
# === CPU base image (minimal) =================================================
9+
ARG CUDA_DEVEL_TAG=11.8.0-cudnn8-devel-ubuntu22.04
1210

1311
FROM python:${PY_VER}-slim-bookworm AS cpu-base
1412
ENV DEBIAN_FRONTEND=noninteractive
@@ -17,61 +15,47 @@ RUN apt-get update && \
1715
build-essential gcc g++ python3-dev python3-rtree \
1816
gdal-bin libgdal-dev python3-gdal python3-opencv libspatialindex-dev \
1917
&& rm -rf /var/lib/apt/lists/*
20-
# ==============================================================================
21-
# === GPU base image (CUDA + runtime-only Python & GDAL) =======================
18+
19+
FROM nvidia/cuda:${CUDA_DEVEL_TAG} AS cuda-dev
20+
2221
FROM nvidia/cuda:${CUDA_TAG} AS gpu-base
2322
ENV DEBIAN_FRONTEND=noninteractive
2423
RUN apt-get update && \
2524
apt-get install -y --no-install-recommends \
26-
python3 python3-pip build-essential gcc g++ python3-dev python3-rtree python-is-python3 \
27-
gdal-bin libgdal-dev python3-gdal python3-opencv libspatialindex-dev cuda-toolkit-11-8 \
28-
&& rm -rf /var/lib/apt/lists/* && \
29-
python3 -m pip install --upgrade pip
25+
python3 python3-pip python3-rtree python-is-python3 \
26+
gdal-bin libgdal-dev python3-gdal python3-opencv \
27+
libspatialindex-dev libpq-dev \
28+
&& rm -rf /var/lib/apt/lists/* \
29+
&& python3 -m pip install --upgrade pip
30+
COPY --from=cuda-dev /usr/local/cuda/nvvm/libdevice /usr/local/cuda/nvvm/libdevice
3031

31-
# ==============================================================================
32-
# === Builder stage (installs everything) ======================================
3332
FROM ${BUILD_TYPE}-base AS builder
3433
ENV DEBIAN_FRONTEND=noninteractive
3534
ARG TF_VER
36-
ARG BUILD_TYPE
37-
3835
COPY docker/pipped-requirements.txt /tmp/pipped-requirements.txt
39-
40-
41-
# Use pip cache and install Python packages (including building GDAL)
4236
RUN --mount=type=cache,target=/root/.cache/pip \
4337
pip install --no-cache-dir --upgrade pip more-itertools && \
4438
pip install --no-cache-dir tensorflow==${TF_VER} && \
45-
pip install "GDAL==$(gdal-config --version)" && \
39+
pip install --no-cache-dir "GDAL==$(gdal-config --version)" && \
4640
pip install --no-cache-dir -r /tmp/pipped-requirements.txt
47-
48-
# Install solaris (local)
4941
COPY solaris /tmp/solaris
5042
RUN --mount=type=cache,target=/root/.cache/pip \
5143
pip install --no-cache-dir /tmp/solaris
52-
53-
# Install scikit-fmm
5444
RUN --mount=type=cache,target=/root/.cache/pip \
5545
pip install --no-cache-dir scikit-fmm
56-
57-
# Install ramp (local)
5846
COPY setup.py README.md /tmp/ramp-code/
5947
COPY ramp /tmp/ramp-code/ramp
6048
RUN --mount=type=cache,target=/root/.cache/pip \
6149
pip install --no-cache-dir /tmp/ramp-code
6250

63-
# ==============================================================================
64-
# === Final minimal runtime image ==============================================
6551
FROM ${BUILD_TYPE}-base AS final
6652
ENV DEBIAN_FRONTEND=noninteractive
67-
6853
ENV CPLUS_INCLUDE_PATH=/usr/include/gdal \
6954
C_INCLUDE_PATH=/usr/include/gdal \
7055
RAMP_HOME=/app
71-
7256
COPY --from=builder /usr/local /usr/local
7357
COPY --from=builder /usr/lib/python*/ /usr/lib/python*/
7458
COPY --from=builder /usr/include/gdal /usr/include/gdal
75-
59+
COPY --from=cuda-dev /usr/local/cuda/nvvm/libdevice /usr/local/cuda/nvvm/libdevice
7660
WORKDIR /app
7761
CMD ["bash"]

0 commit comments

Comments
 (0)