Skip to content

feat: create low dependency images #42

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
54 changes: 54 additions & 0 deletions .github/.devcontainer/devcontainer-light.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"name": "Quarto",
"build": {
"dockerfile": "./Dockerfile",
"context": ".",
"args": {
"IMAGE": "${localEnv:IMAGE}"
},
"options": [
"--label", "org.opencontainers.image.title=${localEnv:ANNOTATION_TITLE}",
"--annotation", "org.opencontainers.image.title=${localEnv:ANNOTATION_TITLE}",
"--label", "org.opencontainers.image.description=${localEnv:ANNOTATION_DESCRIPTION}",
"--annotation", "org.opencontainers.image.description=${localEnv:ANNOTATION_DESCRIPTION}",
"--label", "org.opencontainers.image.authors=${localEnv:ANNOTATION_AUTHORS}",
"--annotation", "org.opencontainers.image.authors=${localEnv:ANNOTATION_AUTHORS}",
"--label", "org.opencontainers.image.url=${localEnv:ANNOTATION_URL}",
"--annotation", "org.opencontainers.image.url=${localEnv:ANNOTATION_URL}",
"--label", "org.opencontainers.image.source=${localEnv:ANNOTATION_URL}",
"--annotation", "org.opencontainers.image.source=${localEnv:ANNOTATION_URL}",
"--label", "org.opencontainers.image.version=${localEnv:ANNOTATION_VERSION}",
"--annotation", "org.opencontainers.image.version=${localEnv:ANNOTATION_VERSION}",
"--label", "org.opencontainers.image.licenses=${localEnv:ANNOTATION_LICENSE}",
"--annotation", "org.opencontainers.image.licenses=${localEnv:ANNOTATION_LICENSE}"
]
},
"remoteUser": "${localEnv:USER}",
"features": {
"ghcr.io/devcontainers/features/common-utils:2": {
"installZsh": "true",
"username": "${localEnv:USER}",
// "userUid": "1000",
// "userGid": "1000",
"upgradePackages": "true"
},
"ghcr.io/devcontainers/features/git:1": {
"version": "latest",
"ppa": "false"
},
"./quarto-computing-dependencies": {
"installOnPlatforms": "amd64",
"rDeps": "false",
"pythonDeps": "false",
"juliaDeps": "false"
},
"./uv": {
"version": "latest"
},
"ghcr.io/rocker-org/devcontainer-features/quarto-cli:1": {
"version": "${localEnv:QUARTO_VERSION}",
"installTinyTex": "false",
"installChromium": "false"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,27 @@ fi

quarto_r_deps() {
local deps=$1
if [ "${deps}" = "false" ]; then
return
fi
deps=$(echo "${deps}" | sed 's/,/","/g')
su "${USERNAME}" -c "Rscript -e 'pak::pkg_install(c(\"${deps}\"))'"
}

quarto_python_deps() {
local deps=$1
if [ "${deps}" = "false" ]; then
return
fi
deps=$(echo "${deps}" | sed 's/,/ /g')
python3 -m pip install ${deps}
}

quarto_julia_deps() {
local deps=$1
if [ "${deps}" = "false" ]; then
return
fi
deps=$(echo "${deps}" | sed 's/,/","/g')
su "${USERNAME}" -c "~/.juliaup/bin/julia -e 'using Pkg; Pkg.add.([\"${deps}\"])'"
}
Expand Down
13 changes: 11 additions & 2 deletions .github/workflows/devcontainer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,16 @@ jobs:
include:
- QUARTO_VERSION: release
IMAGE_TAG: release,release-jammy,latest
CONFIG_FILE: .devcontainer/devcontainer.json
- QUARTO_VERSION: prerelease
IMAGE_TAG: prerelease,prerelease-jammy
CONFIG_FILE: .devcontainer/devcontainer.json
- QUARTO_VERSION: release
IMAGE_TAG: release-light,release-light-jammy
CONFIG_FILE: .devcontainer/devcontainer-light.json
- QUARTO_VERSION: prerelease
IMAGE_TAG: prerelease-light,prerelease-light-jammy
CONFIG_FILE: .devcontainer/devcontainer-light.json
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand Down Expand Up @@ -68,6 +76,7 @@ jobs:
eventFilterForPush: "release"
platform: linux/amd64
runCmd: echo "$(CI=true quarto check 2>&1)" | sed '/^(/d; s/\x1b\[[0-9;]*[mGK]//g'
configFile: ${{ matrix.CONFIG_FILE }}
env:
IMAGE: "buildpack-deps:jammy-curl"
QUARTO_VERSION: ${{ matrix.QUARTO_VERSION }}
Expand All @@ -80,14 +89,14 @@ jobs:
ANNOTATION_LICENSE: "MIT"
- name: Test Dev Container
env:
QUARTO_VERSION: ${{ matrix.QUARTO_VERSION }}
IMAGE_TAG: ${{ matrix.IMAGE_TAG }}
DEVCONTAINER_RUN_CMD: ${{ steps.devcontainer-ci.outputs.runCmdOutput }}
run: |
echo "::group::Quarto Check"
echo "${DEVCONTAINER_RUN_CMD}"
echo "::endgroup::"

echo "## Quarto Check Results: ${QUARTO_VERSION}" >>$GITHUB_STEP_SUMMARY
echo "## Quarto Check Results: ${IMAGE_TAG}" >>$GITHUB_STEP_SUMMARY
echo "<details><summary>Quarto Check Results</summary>" >>$GITHUB_STEP_SUMMARY
echo "" >>$GITHUB_STEP_SUMMARY
echo '```txt' >>$GITHUB_STEP_SUMMARY
Expand Down
1 change: 1 addition & 0 deletions init-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ initialise_r() {
if [ -f ".Rprofile" ] && grep -q 'source("renv/activate.R")' .Rprofile; then
sed -i '' '/source("renv\/activate.R")/d' .Rprofile
fi
Rscript -e 'if (!requireNamespace("renv", quietly = TRUE)) pak::pkg_install("renv")'
Rscript -e 'renv::init(bare = FALSE)'
Rscript -e "renv::install(c('${deps}'))"
Rscript -e 'renv::snapshot(type = "all")'
Expand Down
Loading