Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
// "installChromium": "false"
// }
},
"postStartCommand": ["bash", "init.sh"],
"customizations": {
"vscode": {
"extensions": [
Expand Down
2 changes: 1 addition & 1 deletion .github/.devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
ARG VARIANT="jammy"
FROM buildpack-deps:${VARIANT}-curl
FROM --platform=linux/amd64 buildpack-deps:${VARIANT}-curl
3 changes: 3 additions & 0 deletions .github/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
"ghcr.io/julialang/devcontainer-features/julia:1": {
"channel": "release"
},
"./quarto-computing-dependencies": {
"dependencies": "all"
},
"ghcr.io/rocker-org/devcontainer-features/quarto-cli:1": {
"version": "prerelease",
"installTinyTex": "true",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"id": "quarto-computing-dependencies",
"version": "1.0.0",
"name": "Install Computing Dependencies for Quarto",
"description": "Install R, Python, and Julia dependencies for Quarto.",
"options": {
"dependencies": {
"type": "string",
"enum": ["all", "r", "python", "julia"],
"default": "all",
"description": "Specify what dependencies to install."
}
},
"dependsOn": {
"ghcr.io/devcontainers/features/common-utils": {},
"ghcr.io/rocker-org/devcontainer-features/r-rig": {},
"ghcr.io/devcontainers/features/python": {},
"ghcr.io/julialang/devcontainer-features/julia": {}
},
"installsAfter": [
"ghcr.io/devcontainers/features/common-utils",
"ghcr.io/rocker-org/devcontainer-features/r-rig",
"ghcr.io/devcontainers/features/python",
"ghcr.io/julialang/devcontainer-features/julia"
]
}
62 changes: 62 additions & 0 deletions .github/.devcontainer/quarto-computing-dependencies/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#!/usr/bin/env bash

set -e

export DEBIAN_FRONTEND=noninteractive

DEPENDENCIES=${DEPENDENCIES:-"all"}

USERNAME=${USERNAME:-${_REMOTE_USER:-"automatic"}}

set -e

if [ "$(id -u)" -ne 0 ]; then
echo -e 'Script must be run as root. Use sudo, su, or add "USER root" to your Dockerfile before running this script.'
exit 1
fi

# Determine the appropriate non-root user
if [ "${USERNAME}" = "auto" ] || [ "${USERNAME}" = "automatic" ]; then
USERNAME=""
POSSIBLE_USERS=("vscode" "node" "codespace" "$(awk -v val=1000 -F ":" '$3==val{print $1}' /etc/passwd)")
for CURRENT_USER in "${POSSIBLE_USERS[@]}"; do
if id -u "${CURRENT_USER}" >/dev/null 2>&1; then
USERNAME=${CURRENT_USER}
break
fi
done
if [ "${USERNAME}" = "" ]; then
USERNAME=root
fi
elif [ "${USERNAME}" = "none" ] || ! id -u "${USERNAME}" >/dev/null 2>&1; then
USERNAME=root
fi

quarto_r_deps() {
su "${USERNAME}" -c "Rscript -e 'pak::pkg_install(\"rmarkdown\")'"
}

quarto_python_deps() {
su "${USERNAME}" -c "python3 -m pip install jupyter"
}

quarto_julia_deps() {
su "${USERNAME}" -c "~/.juliaup/bin/julia -e 'using Pkg; Pkg.add(\"IJulia\")'"
}

case ${DEPENDENCIES} in
all)
quarto_r_deps
quarto_python_deps
quarto_julia_deps
;;
r)
quarto_r_deps
;;
python)
quarto_python_deps
;;
julia)
quarto_julia_deps
;;
esac
0 init.sh → init-env.sh
100755 → 100644
File renamed without changes.