Skip to content

Commit acd62e3

Browse files
authored
feat: add devcontainer (#313)
1 parent cd7e63e commit acd62e3

File tree

5 files changed

+125
-2
lines changed

5 files changed

+125
-2
lines changed

.devcontainer/Dockerfile.template

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
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+
# This Dockerfile is used to build a development container for Iceberg C++.
19+
# It is based on the Ubuntu image and installs necessary dependencies.
20+
21+
FROM ubuntu:24.04
22+
23+
# Install necessary packages
24+
RUN apt update && \
25+
apt install -y \
26+
bash-completion \
27+
build-essential \
28+
ccache \
29+
cmake \
30+
curl \
31+
gcc \
32+
g++ \
33+
git \
34+
htop \
35+
libboost-all-dev \
36+
libcurl4-openssl-dev \
37+
libssl-dev \
38+
libxml2-dev \
39+
lsb-release \
40+
meson \
41+
ninja-build \
42+
pkg-config \
43+
python3 \
44+
python3-pip \
45+
vim \
46+
wget \
47+
sudo \
48+
&& rm -rf /var/lib/apt/lists/*
49+
50+
# Add a user for development
51+
RUN useradd -ms /bin/bash iceberg && \
52+
usermod -aG sudo iceberg && \
53+
echo "iceberg ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/iceberg && \
54+
chmod 0440 /etc/sudoers.d/iceberg
55+
56+
# Switch to the iceberg user
57+
USER iceberg
58+
WORKDIR /home/iceberg
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
{
21+
"name": "Iceberg CPP Dev Container",
22+
"build": {
23+
"dockerfile": "Dockerfile"
24+
},
25+
"runArgs": [
26+
"--ulimit=core=-1",
27+
"--cap-add=SYS_ADMIN",
28+
"--cap-add=SYS_PTRACE",
29+
"--cap-add=PERFMON",
30+
"--security-opt",
31+
"seccomp=unconfined",
32+
"--privileged"
33+
],
34+
"mounts": [
35+
"source=${localEnv:HOME}/.ssh,target=/home/iceberg/.ssh,type=bind,readonly"
36+
],
37+
"customizations": {
38+
"vscode": {
39+
"extensions": [
40+
"eamodio.gitlens"
41+
],
42+
"settings": {
43+
"editor.formatOnSave": true
44+
}
45+
}
46+
}
47+
}

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,16 @@ cmake-build-debug/
2020
cmake-build-release/
2121
.DS_Store
2222

23-
2423
# intellij files
2524
.idea
2625

2726
# vscode files
2827
.vscode
28+
.cache
29+
30+
# devcontainer
31+
.devcontainer/*
32+
!.devcontainer/*.template
2933

3034
# meson subprojects - wrap files need to be kept to let meson download
3135
# dependencies as needed, but dependencies themselves should not be versioned

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ repos:
3333
rev: v20.1.8
3434
hooks:
3535
- id: clang-format
36-
exclude: ^src/iceberg/test/resources/.*\.json$
36+
exclude_types: [json]
3737

3838
- repo: https://github.com/cheshirekow/cmake-format-precommit
3939
rev: v0.6.10

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,20 @@ pre-commit install
100100

101101
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`.
102102

103+
### Dev Containers
104+
105+
We provide Dev Container configuration file templates.
106+
107+
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.
108+
109+
```
110+
cd .devcontainer
111+
cp Dockerfile.template Dockerfile
112+
cp devcontainer.json.template devcontainer.json
113+
```
114+
115+
If you make improvements that could benefit all developers, please update the template files and submit a pull request.
116+
103117
## License
104118

105119
Licensed under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0)

0 commit comments

Comments
 (0)