From db695f9ab0db6d3b88bf1ec3a2eac7587e79bd1d Mon Sep 17 00:00:00 2001 From: Junwang Zhao Date: Tue, 11 Nov 2025 23:51:13 +0800 Subject: [PATCH 1/5] feat: add devcontainer --- .devcontainer/devcontainer.json | 47 +++++++++++++++++++++++++++ .gitignore | 2 +- .pre-commit-config.yaml | 2 +- Dockerfile | 57 +++++++++++++++++++++++++++++++++ 4 files changed, 106 insertions(+), 2 deletions(-) create mode 100644 .devcontainer/devcontainer.json create mode 100644 Dockerfile diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 000000000..3c1c72a23 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,47 @@ +/* + * 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. + */ + +{ + "name": "Iceberg CPP Dev Container", + "build": { + "dockerfile": "../Dockerfile" + }, + "runArgs": [ + "--ulimit=core=-1", + "--cap-add=SYS_ADMIN", + "--cap-add=SYS_PTRACE", + "--cap-add=PERFMON", + "--security-opt", + "seccomp=unconfined", + "--privileged" + ], + "mounts": [ + "source=${localEnv:HOME}/.ssh,target=/home/iceberg/.ssh,type=bind,readonly" + ], + "customizations": { + "vscode": { + "extensions": [ + "eamodio.gitlens" + ], + "settings": { + "editor.formatOnSave": true + } + } + } +} diff --git a/.gitignore b/.gitignore index 8cd4f4e10..356600da5 100644 --- a/.gitignore +++ b/.gitignore @@ -20,12 +20,12 @@ cmake-build-debug/ cmake-build-release/ .DS_Store - # intellij files .idea # vscode files .vscode +.cache # meson subprojects - wrap files need to be kept to let meson download # dependencies as needed, but dependencies themselves should not be versioned diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4ee4a0b83..7a10bbb63 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -33,7 +33,7 @@ repos: rev: v20.1.8 hooks: - id: clang-format - exclude: ^src/iceberg/test/resources/.*\.json$ + exclude_types: [json] - repo: https://github.com/cheshirekow/cmake-format-precommit rev: v0.6.10 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..70f877213 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,57 @@ +# 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. + +# This Dockerfile is used to build a development container for Iceberg C++. +# It is based on the Ubuntu image and installs necessary dependencies. + +FROM ubuntu:24.04 + +# Install necessary packages +RUN apt-get update && \ + apt-get install -y \ + bash-completion \ + build-essential \ + ccache \ + cmake \ + curl \ + gcc \ + g++ \ + git \ + htop \ + libboost-all-dev \ + libcurl4-openssl-dev \ + libssl-dev \ + libxml2-dev \ + meson \ + ninja-build \ + pkg-config \ + python3 \ + python3-pip \ + vim \ + wget \ + sudo \ + && rm -rf /var/lib/apt/lists/* + +# Add a user for development +RUN useradd -ms /bin/bash iceberg && \ + usermod -aG sudo iceberg && \ + echo "iceberg ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/iceberg && \ + chmod 0440 /etc/sudoers.d/iceberg + +# Switch to the iceberg user +USER iceberg +WORKDIR /home/iceberg From c3f04983e8a177d1c1f93d67b22a631b7fa7290a Mon Sep 17 00:00:00 2001 From: Junwang Zhao Date: Wed, 12 Nov 2025 23:44:47 +0800 Subject: [PATCH 2/5] Move dev Dockerfile to .devcontainer --- Dockerfile => .devcontainer/Dockerfile | 5 +++-- .devcontainer/devcontainer.json | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) rename Dockerfile => .devcontainer/Dockerfile (96%) diff --git a/Dockerfile b/.devcontainer/Dockerfile similarity index 96% rename from Dockerfile rename to .devcontainer/Dockerfile index 70f877213..57333753c 100644 --- a/Dockerfile +++ b/.devcontainer/Dockerfile @@ -21,8 +21,8 @@ FROM ubuntu:24.04 # Install necessary packages -RUN apt-get update && \ - apt-get install -y \ +RUN apt update && \ + apt install -y \ bash-completion \ build-essential \ ccache \ @@ -36,6 +36,7 @@ RUN apt-get update && \ libcurl4-openssl-dev \ libssl-dev \ libxml2-dev \ + lsb-release \ meson \ ninja-build \ pkg-config \ diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 3c1c72a23..dea152b76 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -20,7 +20,7 @@ { "name": "Iceberg CPP Dev Container", "build": { - "dockerfile": "../Dockerfile" + "dockerfile": "Dockerfile" }, "runArgs": [ "--ulimit=core=-1", From 36efb55a4f0b1cb3e118cc831a6951f610f0efd9 Mon Sep 17 00:00:00 2001 From: Junwang Zhao Date: Thu, 13 Nov 2025 21:17:14 +0800 Subject: [PATCH 3/5] fix: suffix .devcontainer files with .sample and add README sec --- .devcontainer/{Dockerfile => Dockerfile.sample} | 0 ...{devcontainer.json => devcontainer.json.sample} | 0 .gitignore | 4 ++++ README.md | 14 ++++++++++++++ 4 files changed, 18 insertions(+) rename .devcontainer/{Dockerfile => Dockerfile.sample} (100%) rename .devcontainer/{devcontainer.json => devcontainer.json.sample} (100%) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile.sample similarity index 100% rename from .devcontainer/Dockerfile rename to .devcontainer/Dockerfile.sample diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json.sample similarity index 100% rename from .devcontainer/devcontainer.json rename to .devcontainer/devcontainer.json.sample diff --git a/.gitignore b/.gitignore index 356600da5..7075621af 100644 --- a/.gitignore +++ b/.gitignore @@ -27,6 +27,10 @@ cmake-build-release/ .vscode .cache +# devcontainer +.devcontainer/* +!.devcontainer/*.sample + # meson subprojects - wrap files need to be kept to let meson download # dependencies as needed, but dependencies themselves should not be versioned /subprojects/* diff --git a/README.md b/README.md index 7dd32a980..3ecd9328e 100644 --- a/README.md +++ b/README.md @@ -100,6 +100,20 @@ pre-commit install This will setup a git pre-commit-hook that is executed on each commit and will report the linting problems. To run all hooks on all files use `pre-commit run -a`. +### Dev Containers + +We provide sample Dev Container configuration files. + +To use a Dev Container as your development environment, follow the steps below, then select `Dev Containers: Reopen in Container` from VS Code's Command Palette. + +``` +cd .devcontainer +cp Dockerfile.sample Dockerfile +cp devcontainer.json.sample devcontainer.json +``` + +If you make improvements that could benefit all developers, please update the sample files and submit a pull request. + ## License Licensed under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0) From b73882feb91bec8d30063e575ff37c1b7f2caa6a Mon Sep 17 00:00:00 2001 From: Junwang Zhao Date: Fri, 14 Nov 2025 08:12:19 +0800 Subject: [PATCH 4/5] Use template as devcontainer file suffix Co-authored-by: Gang Wu --- .gitignore | 2 +- README.md | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 7075621af..9e79c86e7 100644 --- a/.gitignore +++ b/.gitignore @@ -29,7 +29,7 @@ cmake-build-release/ # devcontainer .devcontainer/* -!.devcontainer/*.sample +!.devcontainer/*.template # meson subprojects - wrap files need to be kept to let meson download # dependencies as needed, but dependencies themselves should not be versioned diff --git a/README.md b/README.md index 3ecd9328e..26bcf5a2b 100644 --- a/README.md +++ b/README.md @@ -102,17 +102,17 @@ This will setup a git pre-commit-hook that is executed on each commit and will r ### Dev Containers -We provide sample Dev Container configuration files. +We provide Dev Container configuration file templates. To use a Dev Container as your development environment, follow the steps below, then select `Dev Containers: Reopen in Container` from VS Code's Command Palette. ``` cd .devcontainer -cp Dockerfile.sample Dockerfile -cp devcontainer.json.sample devcontainer.json +cp Dockerfile.template Dockerfile +cp devcontainer.json.template devcontainer.json ``` -If you make improvements that could benefit all developers, please update the sample files and submit a pull request. +If you make improvements that could benefit all developers, please update the template files and submit a pull request. ## License From 6a426ea8cee355c1c4388acf60eca43e4b326746 Mon Sep 17 00:00:00 2001 From: Junwang Zhao Date: Fri, 14 Nov 2025 08:14:13 +0800 Subject: [PATCH 5/5] fix: rename devcontain file names --- .devcontainer/{Dockerfile.sample => Dockerfile.template} | 0 .../{devcontainer.json.sample => devcontainer.json.template} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename .devcontainer/{Dockerfile.sample => Dockerfile.template} (100%) rename .devcontainer/{devcontainer.json.sample => devcontainer.json.template} (100%) diff --git a/.devcontainer/Dockerfile.sample b/.devcontainer/Dockerfile.template similarity index 100% rename from .devcontainer/Dockerfile.sample rename to .devcontainer/Dockerfile.template diff --git a/.devcontainer/devcontainer.json.sample b/.devcontainer/devcontainer.json.template similarity index 100% rename from .devcontainer/devcontainer.json.sample rename to .devcontainer/devcontainer.json.template