| # Licensed to the Apache Software Foundation (ASF) under one | |
| # or more contributor license agreements. See the NOTICE file | |
| # distributed with this work for additional information | |
| # regarding copyright ownership. The ASF licenses this file | |
| # to you under the Apache License, Version 2.0 (the | |
| # "License"); you may not use this file except in compliance | |
| # with the License. You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, | |
| # software distributed under the License is distributed on an | |
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
| # KIND, either express or implied. See the License for the | |
| # specific language governing permissions and limitations | |
| # under the License. | |
| # Adapted from Apache Iceberg C++ | |
| # https://github.com/apache/iceberg-cpp/blob/v0.2.0/.devcontainer/Dockerfile.template | |
| # | |
| # This Dockerfile is used to build a development container for Paimon C++. | |
| # Base: Ubuntu 24.04. Rust toolchain is installed via Dev Container | |
| # Feature `ghcr.io/devcontainers/features/rust:1` (see devcontainer.json), | |
| # so it does NOT appear in this Dockerfile. | |
| FROM ubuntu:24.04 | |
| # Optional apt mirror. Defaults to the upstream Ubuntu mirrors so builds work | |
| # everywhere; pass --build-arg APT_MIRROR=<host> (e.g. http://mirrors.aliyun.com) | |
| # to use a regional mirror for faster downloads inside mainland China. | |
| ARG APT_MIRROR= | |
| RUN if [ -n "${APT_MIRROR}" ]; then \ | |
| sed -i \ | |
| -e "s|http://archive.ubuntu.com/ubuntu|${APT_MIRROR}/ubuntu|g" \ | |
| -e "s|http://security.ubuntu.com/ubuntu|${APT_MIRROR}/ubuntu|g" \ | |
| -e "s|http://ports.ubuntu.com/ubuntu-ports|${APT_MIRROR}/ubuntu-ports|g" \ | |
| /etc/apt/sources.list.d/ubuntu.sources; \ | |
| fi | |
| # Optional rustup mirror for the Dev Container Feature | |
| # `ghcr.io/devcontainers/features/rust:1` (and any later `rustup` calls). | |
| # Defaults to the upstream static.rust-lang.org; pass | |
| # --build-arg RUST_DIST_SERVER=https://mirrors.ustc.edu.cn/rust-static for a | |
| # China-friendly CDN. Set as ENV so it is inherited by every subsequent layer. | |
| ARG RUST_DIST_SERVER=https://static.rust-lang.org | |
| ENV RUSTUP_DIST_SERVER=${RUST_DIST_SERVER} \ | |
| RUSTUP_UPDATE_ROOT=${RUST_DIST_SERVER}/rustup | |
| # Install necessary packages | |
| RUN apt update && \ | |
| apt install -y \ | |
| bash-completion \ | |
| build-essential \ | |
| ccache \ | |
| cmake \ | |
| curl \ | |
| gcc \ | |
| g++ \ | |
| git \ | |
| htop \ | |
| libboost-all-dev \ | |
| libcurl4-openssl-dev \ | |
| libssl-dev \ | |
| libxml2-dev \ | |
| lsb-release \ | |
| meson \ | |
| ninja-build \ | |
| pkg-config \ | |
| python3 \ | |
| python3-pip \ | |
| vim \ | |
| wget \ | |
| sudo \ | |
| # ---- additions for the Rust FFI builds (Rust + Sanitizer + LLVM) ---- | |
| clang \ | |
| clang-format \ | |
| clang-tidy \ | |
| lld \ | |
| llvm \ | |
| libclang-rt-dev \ | |
| gdb \ | |
| lldb \ | |
| valgrind \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Add a user for development | |
| RUN useradd -ms /bin/bash paimon && \ | |
| usermod -aG sudo paimon && \ | |
| echo "paimon ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/paimon && \ | |
| chmod 0440 /etc/sudoers.d/paimon | |
| # Switch to the paimon user | |
| USER paimon | |
| WORKDIR /home/paimon |