Skip to content

Commit 82b279e

Browse files
committed
multi dev container setup
1 parent 8a7c4db commit 82b279e

5 files changed

Lines changed: 35 additions & 7 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
FROM --platform=linux/amd64 mcr.microsoft.com/devcontainers/base:ubuntu-22.04
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"name": "rJavaEnv (amd64 - Fast Builds)",
3+
"build": {
4+
"dockerfile": "Dockerfile",
5+
"context": ".."
6+
},
7+
"platform": "linux/amd64",
8+
"features": {
9+
"ghcr.io/rocker-org/devcontainer-features/r-rig:1": {}
10+
},
11+
"customizations": {
12+
"vscode": {
13+
"extensions": [
14+
"quarto.quarto",
15+
"Posit.air-vscode",
16+
"REditorSupport.r"
17+
]
18+
}
19+
},
20+
"postCreateCommand": "bash .devcontainer/setup.sh",
21+
"remoteEnv": {
22+
"PKG_SYSREQS": "true"
23+
}
24+
}

.devcontainer/devcontainer.json renamed to .devcontainer/rJavaEnv-arm64/devcontainer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
2-
"name": "rJavaEnv Dev Container",
3-
"image": "mcr.microsoft.com/devcontainers/r:latest",
2+
"name": "rJavaEnv (arm64 - Positron Compatible)",
3+
"image": "mcr.microsoft.com/devcontainers/base:ubuntu-22.04",
44
"features": {
5-
"ghcr.io/devcontainers/features/common-utils:2": {}
5+
"ghcr.io/rocker-org/devcontainer-features/r-rig:1": {}
66
},
77
"customizations": {
88
"vscode": {
@@ -15,6 +15,6 @@
1515
},
1616
"postCreateCommand": "bash .devcontainer/setup.sh",
1717
"remoteEnv": {
18-
"PATH": "${containerEnv:PATH}:/home/vscode/.local/bin"
18+
"PKG_SYSREQS": "true"
1919
}
2020
}

.devcontainer/setup.R

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@ if (!requireNamespace("remotes", quietly = TRUE)) {
55
install.packages("remotes")
66
}
77

8+
library(remotes)
9+
810
# Get dependencies from DESCRIPTION in the current directory
9-
deps <- remotes::dev_package_deps(dependencies = TRUE)
11+
deps <- dev_package_deps(dependencies = TRUE)
1012

1113
# Filter out rJava to ensure no Java is installed
1214
# deps is a data.frame with class "package_deps"
1315
deps <- deps[deps$package != "rJava", ]
1416

1517
# Install/Update the selected packages
1618
# The update() method for package_deps respects version requirements
17-
remotes::update(deps, upgrade = "always")
19+
update(deps, upgrade = "always")

.devcontainer/setup.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ echo "Installing Posit Air CLI version ${AIR_VERSION} for ${AIR_ARCH}..."
2828
TMP_DIR=$(mktemp -d)
2929
curl -LsSf "$URL" -o "${TMP_DIR}/${FILENAME}"
3030
tar -xzf "${TMP_DIR}/${FILENAME}" -C "$TMP_DIR"
31-
mv "${TMP_DIR}/air" "$INSTALL_DIR/air"
31+
# The tarball extracts a directory named air-${AIR_ARCH}-${PLATFORM}
32+
mv "${TMP_DIR}/air-${AIR_ARCH}-${PLATFORM}/air" "$INSTALL_DIR/air"
3233
rm -rf "$TMP_DIR"
3334

3435
# Ensure air is on PATH for the remainder of this setup script.

0 commit comments

Comments
 (0)