Skip to content

Commit

Permalink
Add Dev Containers with Clang using -stdlib=libc++
Browse files Browse the repository at this point in the history
  • Loading branch information
benz0li committed Mar 10, 2024
1 parent a9a3ba4 commit deeaa7f
Show file tree
Hide file tree
Showing 13 changed files with 337 additions and 15 deletions.
4 changes: 2 additions & 2 deletions .devcontainer/.gitignore
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
*

!/debian-*/
!/conf/
!/conf/shell/
!/conf/shell/etc/
!/conf/shell/etc/skel/
!/conf/shell/var/
!/conf/shell/var/tmp/
!/conf/shell/var/tmp/snippets/
!/debian-*/
!/scripts/
!/scripts/usr/
!/scripts/usr/local/
!/scripts/usr/local/bin/

!/debian-*/devcontainer.json
!/conf/shell/etc/skel/.profile
!/conf/shell/var/tmp/snippets/*.sh
!/debian-*/devcontainer.json
!/scripts/usr/local/bin/*.sh

!/.gitignore
Expand Down
18 changes: 12 additions & 6 deletions .devcontainer/Debian.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@ ARG DEBIAN_FRONTEND=noninteractive

ARG COMPILER
ARG COMPILER_VERSION
ARG CXX_STDLIB

# hadolint ignore=DL3008,SC2086
RUN apt-get update \
RUN CXX_STDLIB_VERSION=${CXX_STDLIB:+$COMPILER_VERSION} \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
dpkg-dev \
g++ \
"${CXX_STDLIB:-g++}${CXX_STDLIB_VERSION:+-}${CXX_STDLIB_VERSION}${CXX_STDLIB:+-dev}" \
libc6-dev \
make \
ca-certificates \
Expand Down Expand Up @@ -108,11 +110,12 @@ RUN if [ "$R_VERSION" = "devel" ]; then \
R_SRC="base/R-${R_VERSION%%.*}/R-${R_VERSION}.tar.gz"; \
fi \
&& cd /tmp \
&& wget --progress=dot:giga https://cran.r-project.org/src/${R_SRC} -O "R.tar.gz" \
&& wget --progress=dot:mega https://cran.r-project.org/src/${R_SRC} -O "R.tar.gz" \
&& tar zxf R.tar.gz --no-same-owner \
&& cd R-* \
&& export ${COMPILER:+CC=${COMPILER}${COMPILER_VERSION:+-}${COMPILER_VERSION}} \
&& export ${COMPILER:+CXX=${COMPILER}++${COMPILER_VERSION:+-}${COMPILER_VERSION}} \
&& export ${COMPILER:+CC="${COMPILER}${COMPILER_VERSION:+-}${COMPILER_VERSION}"} \
&& export ${COMPILER:+CXX="${COMPILER}++${COMPILER_VERSION:+-}${COMPILER_VERSION}"} \
&& export ${CXX_STDLIB:+CXX="$CXX -stdlib=${CXX_STDLIB}"} \
&& R_PAPERSIZE=letter \
&& R_BROWSER=xdg-open \
&& PAGER=/usr/bin/pager \
Expand All @@ -138,6 +141,7 @@ ARG BASE_IMAGE_TAG
ARG BLAS=libopenblas-dev
ARG COMPILER
ARG COMPILER_VERSION
ARG CXX_STDLIB
ARG CRAN

ENV BASE_IMAGE=${BASE_IMAGE}:${BASE_IMAGE_TAG} \
Expand All @@ -159,14 +163,16 @@ RUN apt-get update \
&& apt-get remove -y --purge devscripts \
&& apt-get autoremove -y \
## Install R runtime dependencies
&& CXX_STDLIB_VERSION=${CXX_STDLIB:+$COMPILER_VERSION} \
&& apt-get install -y --no-install-recommends \
dpkg-dev \
g++ \
"${CXX_STDLIB:-g++}${CXX_STDLIB_VERSION:+-}${CXX_STDLIB_VERSION}${CXX_STDLIB:+-dev}" \
libc6-dev \
make \
ca-certificates \
"${COMPILER:-gcc}${COMPILER_VERSION:+-}${COMPILER_VERSION}" \
gfortran \
"${CXX_STDLIB}${CXX_STDLIB:+abi}${CXX_STDLIB_VERSION:+-}${CXX_STDLIB_VERSION}${CXX_STDLIB:+-dev}" \
libbz2-dev \
'^libcurl[3|4]$' \
libicu-dev \
Expand Down
80 changes: 80 additions & 0 deletions .devcontainer/debian-stable-clang-libcpp/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
{
"name": "R devel (Debian stable, Clang, libc++)",
"build": {
"dockerfile": "../Debian.Dockerfile",
"context": "..",
"args": {
"BASE_IMAGE": "debian",
"BASE_IMAGE_TAG": "stable",
"COMPILER": "clang",
"CXX_STDLIB": "libc++",
"CRAN": "https://cloud.r-project.org",
"R_VERSION": "devel",
// "NCPUS": "1",
"USE_ZSH_FOR_ROOT": "unset-to-use-bash",
"SET_LANG": "en_US.UTF-8",
"SET_TZ": "Etc/UTC"
}
},

"onCreateCommand": "onCreateCommand.sh",
"postCreateCommand": "postCreateCommand.sh",
"postStartCommand": "postStartCommand.sh",

"features": {
"ghcr.io/devcontainers/features/common-utils:2": {
"configureZshAsDefaultShell": true,
"upgradePackages": false,
"username": "vscode",
"userUid": "automatic",
"userGid": "automatic"
},
// A comma separated list of packages to install
"ghcr.io/rocker-org/devcontainer-features/apt-packages:1": {
"packages": "qpdf"
}
},

"customizations": {
"vscode": {
"extensions": [
"DavidAnson.vscode-markdownlint",
"[email protected]",
"editorconfig.editorconfig",
"GitHub.vscode-pull-request-github",
"grapecity.gc-excelviewer",
"mhutchie.git-graph",
"mutantdino.resourcemonitor",
"redhat.vscode-yaml",
"REditorSupport.r",
"timonwong.shellcheck",
"exiasr.hadolint",
"ms-vscode.cpptools"
],
"settings": {
"gitlens.showWelcomeOnInstall": false,
"gitlens.showWhatsNewAfterUpgrades": false,
"r.bracketedPaste": true,
"r.plot.useHttpgd": true,
"r.rterm.linux": "/usr/local/bin/radian",
"r.rterm.option": [
"--no-save",
"--no-restore"
],
"r.workspaceViewer.showObjectSize": true,
"resmon.show.battery": false,
"resmon.show.cpufreq": false
}
}
},

// Set 'remoteUser' to 'root' to connect as root instead.
"remoteUser": "vscode",

"remoteEnv": {
// Pip: Install packages to the user site
"PIP_USER": "1",
// A comma separated list of packages to install
"R_PACKAGES": "future"
}
}
1 change: 0 additions & 1 deletion .devcontainer/debian-stable-clang/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
"REditorSupport.r",
"timonwong.shellcheck",
"exiasr.hadolint",
"ms-azuretools.vscode-docker",
"ms-vscode.cpptools"
],
"settings": {
Expand Down
1 change: 0 additions & 1 deletion .devcontainer/debian-stable-gcc/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
"REditorSupport.r",
"timonwong.shellcheck",
"exiasr.hadolint",
"ms-azuretools.vscode-docker",
"ms-vscode.cpptools"
],
"settings": {
Expand Down
80 changes: 80 additions & 0 deletions .devcontainer/debian-testing-clang-libcpp/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
{
"name": "R devel (Debian testing, Clang, libc++)",
"build": {
"dockerfile": "../Debian.Dockerfile",
"context": "..",
"args": {
"BASE_IMAGE": "debian",
"BASE_IMAGE_TAG": "testing",
"COMPILER": "clang",
"CXX_STDLIB": "libc++",
"CRAN": "https://cloud.r-project.org",
"R_VERSION": "devel",
// "NCPUS": "1",
"USE_ZSH_FOR_ROOT": "unset-to-use-bash",
"SET_LANG": "en_US.UTF-8",
"SET_TZ": "Etc/UTC"
}
},

"onCreateCommand": "onCreateCommand.sh",
"postCreateCommand": "postCreateCommand.sh",
"postStartCommand": "postStartCommand.sh",

"features": {
"ghcr.io/devcontainers/features/common-utils:2": {
"configureZshAsDefaultShell": true,
"upgradePackages": false,
"username": "vscode",
"userUid": "automatic",
"userGid": "automatic"
},
// A comma separated list of packages to install
"ghcr.io/rocker-org/devcontainer-features/apt-packages:1": {
"packages": "qpdf"
}
},

"customizations": {
"vscode": {
"extensions": [
"DavidAnson.vscode-markdownlint",
"[email protected]",
"editorconfig.editorconfig",
"GitHub.vscode-pull-request-github",
"grapecity.gc-excelviewer",
"mhutchie.git-graph",
"mutantdino.resourcemonitor",
"redhat.vscode-yaml",
"REditorSupport.r",
"timonwong.shellcheck",
"exiasr.hadolint",
"ms-vscode.cpptools"
],
"settings": {
"gitlens.showWelcomeOnInstall": false,
"gitlens.showWhatsNewAfterUpgrades": false,
"r.bracketedPaste": true,
"r.plot.useHttpgd": true,
"r.rterm.linux": "/usr/local/bin/radian",
"r.rterm.option": [
"--no-save",
"--no-restore"
],
"r.workspaceViewer.showObjectSize": true,
"resmon.show.battery": false,
"resmon.show.cpufreq": false
}
}
},

// Set 'remoteUser' to 'root' to connect as root instead.
"remoteUser": "vscode",

"remoteEnv": {
// Pip: Install packages to the user site
"PIP_USER": "1",
// A comma separated list of packages to install
"R_PACKAGES": "future"
}
}
1 change: 0 additions & 1 deletion .devcontainer/debian-testing-clang/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
"REditorSupport.r",
"timonwong.shellcheck",
"exiasr.hadolint",
"ms-azuretools.vscode-docker",
"ms-vscode.cpptools"
],
"settings": {
Expand Down
1 change: 0 additions & 1 deletion .devcontainer/debian-testing-gcc/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
"REditorSupport.r",
"timonwong.shellcheck",
"exiasr.hadolint",
"ms-azuretools.vscode-docker",
"ms-vscode.cpptools"
],
"settings": {
Expand Down
82 changes: 82 additions & 0 deletions .devcontainer/debian-unstable-clang-18-libcpp/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
{
"name": "R devel (Debian unstable, Clang 18, libc++)",
"build": {
"dockerfile": "../Debian.Dockerfile",
"context": "..",
"args": {
"BASE_IMAGE": "debian",
"BASE_IMAGE_TAG": "unstable",
"COMPILER": "clang",
"COMPILER_VERSION": "18",
"CXX_STDLIB": "libc++",
"CRAN": "https://cloud.r-project.org",
"R_VERSION": "devel",
// "NCPUS": "1",
"INSTALL_COMMON_UTILS": "true",
"USE_ZSH_FOR_ROOT": "unset-to-use-bash",
"SET_LANG": "en_US.UTF-8",
"SET_TZ": "Etc/UTC"
}
},

"onCreateCommand": "onCreateCommand.sh",
"postCreateCommand": "postCreateCommand.sh",
"postStartCommand": "postStartCommand.sh",

"features": {
"ghcr.io/devcontainers/features/common-utils:2": {
"configureZshAsDefaultShell": true,
"upgradePackages": false,
"username": "vscode",
"userUid": "automatic",
"userGid": "automatic"
},
// A comma separated list of packages to install
"ghcr.io/rocker-org/devcontainer-features/apt-packages:1": {
"packages": "qpdf"
}
},

"customizations": {
"vscode": {
"extensions": [
"DavidAnson.vscode-markdownlint",
"[email protected]",
"editorconfig.editorconfig",
"GitHub.vscode-pull-request-github",
"grapecity.gc-excelviewer",
"mhutchie.git-graph",
"mutantdino.resourcemonitor",
"redhat.vscode-yaml",
"REditorSupport.r",
"timonwong.shellcheck",
"exiasr.hadolint",
"ms-vscode.cpptools"
],
"settings": {
"gitlens.showWelcomeOnInstall": false,
"gitlens.showWhatsNewAfterUpgrades": false,
"r.bracketedPaste": true,
"r.plot.useHttpgd": true,
"r.rterm.linux": "/usr/local/bin/radian",
"r.rterm.option": [
"--no-save",
"--no-restore"
],
"r.workspaceViewer.showObjectSize": true,
"resmon.show.battery": false,
"resmon.show.cpufreq": false
}
}
},

// Set 'remoteUser' to 'root' to connect as root instead.
"remoteUser": "vscode",

"remoteEnv": {
// Pip: Install packages to the user site
"PIP_USER": "1",
// A comma separated list of packages to install
"R_PACKAGES": "future"
}
}
1 change: 0 additions & 1 deletion .devcontainer/debian-unstable-clang-18/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
"REditorSupport.r",
"timonwong.shellcheck",
"exiasr.hadolint",
"ms-azuretools.vscode-docker",
"ms-vscode.cpptools"
],
"settings": {
Expand Down
Loading

0 comments on commit deeaa7f

Please sign in to comment.