Skip to content

Commit

Permalink
Merge pull request #885 from greenbone/devcontainer
Browse files Browse the repository at this point in the history
Add a devcontainer setup for gvm-libs development
  • Loading branch information
bjoernricks authored Feb 13, 2025
2 parents 955a5a9 + 079092e commit c014fb0
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
FROM debian:stable-slim

ARG DEBIAN_FRONTEND=noninteractive
ARG CGREEN_VERSION=1.6.2
ARG CGREEN_HASH=fe6be434cbe280330420106bd5d667f1bc84ae9468960053100dbf17071036b9

ARG USERNAME=dev
ARG USER_UID=1000
ARG USER_GID=$USER_UID

# install dependencies
RUN --mount=type=bind,source=.github,target=/source/ \
sh /source/install-dependencies.sh /source/build-dependencies.list
RUN apt-get install -y --no-install-recommends \
clang-format

# add non-root user
RUN groupadd --gid $USER_GID $USERNAME \
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME -s /bin/bash \
&& apt-get update \
&& apt-get install -y --no-install-recommends sudo \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME

# install cgreen
RUN curl -sSL -o cgreen.tar.gz https://github.com/cgreen-devs/cgreen/archive/refs/tags/$CGREEN_VERSION.tar.gz \
&& echo "$CGREEN_HASH cgreen.tar.gz" | sha256sum -c - \
&& tar -xzf cgreen.tar.gz \
&& cd cgreen-* \
&& cmake -Bbuild -DCMAKE_BUILD_TYPE=Release \
&& cmake --build build -j$(nproc) -- install \
&& ldconfig

CMD /bin/bash
16 changes: 16 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "gvm-libs stable",
// "image": "gvm-libs:stable",
"build": {
"dockerfile": "Dockerfile",
"context": ".."
},
"remoteUser": "dev",
"customizations": {
"vscode": {
"extensions": [
"ms-vscode.cpptools-extension-pack"
]
}
}
}
2 changes: 2 additions & 0 deletions .github/build-dependencies.list
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
build-essential
ca-certificates
cmake
curl
git
gnupg
lcov
libcjson-dev
Expand Down

0 comments on commit c014fb0

Please sign in to comment.