Skip to content

Commit edbee72

Browse files
authored
chore(docker): Add Dockerfile for building GPU-enabled sedonadb image (#872)
1 parent b2b475a commit edbee72

4 files changed

Lines changed: 535 additions & 370 deletions

File tree

‎docker/sedonadb-gpu.dockerfile‎

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
FROM nvidia/cuda:13.1.2-devel-ubuntu24.04
19+
20+
# Install system dependencies (initial set; clang added from LLVM apt repo below)
21+
RUN apt-get update && apt-get install -y \
22+
build-essential \
23+
git \
24+
pkg-config \
25+
curl \
26+
python3 \
27+
python3-dev \
28+
python3-pip \
29+
gnupg \
30+
lsb-release \
31+
ca-certificates \
32+
wget \
33+
zip \
34+
unzip \
35+
tar \
36+
clang-18 \
37+
clang++-18 \
38+
libc++-18-dev \
39+
libc++abi-18-dev \
40+
lld-18 \
41+
python3-venv \
42+
&& rm -rf /var/lib/apt/lists/*
43+
44+
# Add Kitware APT repository and install the latest CMake (Updated for Ubuntu 24.04)
45+
RUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null \
46+
&& echo "deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/kitware.list >/dev/null \
47+
&& apt-get update \
48+
&& apt-get install -y cmake \
49+
&& rm -rf /var/lib/apt/lists/*
50+
51+
# Install vcpkg
52+
RUN git clone https://github.com/Microsoft/vcpkg.git /home/ubuntu/vcpkg
53+
WORKDIR /home/ubuntu/vcpkg
54+
RUN ./bootstrap-vcpkg.sh
55+
RUN ./vcpkg install geos
56+
57+
# Copy your project
58+
COPY . /workspace
59+
WORKDIR /workspace
60+
61+
# Set environment variables for build
62+
ENV VCPKG_ROOT=/home/ubuntu/vcpkg
63+
ENV CMAKE_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake
64+
ENV PKG_CONFIG_PATH=$VCPKG_ROOT/installed/x64-linux/lib/pkgconfig
65+
ENV CC=clang-18
66+
ENV CXX=clang++-18
67+
ARG CMAKE_CUDA_ARCHITECTURES="86"
68+
ENV CMAKE_CUDA_ARCHITECTURES=${CMAKE_CUDA_ARCHITECTURES}
69+
ENV LD_LIBRARY_PATH=/usr/local/cuda/lib64/stubs:${LD_LIBRARY_PATH}
70+
71+
# Create and activate virtual environment
72+
RUN python3 -m venv /opt/venv
73+
ENV PATH="/opt/venv/bin:$PATH"
74+
75+
# Pass features to maturin when pip builds the package via PEP517
76+
ENV MATURIN_PEP517_ARGS="--features s2geography,gpu"
77+
78+
# Install maturin AND JupyterLab inside the virtual environment
79+
RUN pip3 install maturin jupyterlab pyproj geoarrow-pyarrow pandas
80+
81+
# Install the project. You may add '-e' to enable the editable mode (uses pyproject -> maturin under the hood) for debug/development purposes
82+
RUN pip3 install "python/sedonadb" -vv
83+
84+
# Clean up the library path so the container uses the real driver at runtime
85+
ENV LD_LIBRARY_PATH=/usr/local/cuda/lib64
86+
ENV NVIDIA_DRIVER_CAPABILITIES=compute,utility,graphics
87+
88+
# --- SECURITY CONFIGURATION ---
89+
# Create a non-root user
90+
RUN useradd -ms /bin/bash jupyteruser
91+
92+
# Change ownership of the workspace and virtual environment to the new user
93+
RUN chown -R jupyteruser:jupyteruser /workspace /opt/venv
94+
95+
# Switch to the non-root user
96+
USER jupyteruser
97+
# ------------------------------
98+
99+
# Expose the default JupyterLab port
100+
EXPOSE 8888
101+
102+
# Launch JupyterLab
103+
CMD ["jupyter", "lab", "--ip=0.0.0.0", "--port=8888", "--no-browser"]
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
# Git
19+
.git
20+
.github
21+
.gitmodules
22+
23+
# IDEs
24+
.idea
25+
.vscode
26+
.history
27+
28+
# Rust build artifacts
29+
target/
30+
python/sedonadb/target/
31+
32+
# Python cache & tests
33+
.pytest_cache/
34+
python/sedonadb/.pytest_cache/
35+
**/__pycache__/
36+
**/*.pyc
37+
**/*.pyo
38+
**/*.pyd
39+
40+
# Python distribution / packaging
41+
python/sedonadb/build/
42+
python/sedonadb/dist/
43+
python/sedonadb/*.egg-info/
44+
python/sedonadb/.eggs/
45+
.eggs/
46+
build/
47+
dist/
48+
*.egg-info/
49+
.venv/
50+
venv/
51+
env/
52+
53+
# Documentation
54+
site/
55+
.ipynb_checkpoints/
56+
docs/.ipynb_checkpoints/
57+
docs/hf-data/
58+
59+
# Release management
60+
dev/release/.env
61+
62+
# Benchmarks & local outputs
63+
benchmarks/
64+
rat.txt
65+
filtered_rat.txt
66+
apache-rat-0.13.jar
67+
68+
# R-related
69+
r/sedonadb/.Rproj.user/

0 commit comments

Comments
 (0)