├── .github └── workflows │ ├── release.yml │ ├── test.yml │ └── validate.yml ├── README.md ├── src └── julia │ ├── NOTES.md │ ├── README.md │ ├── devcontainer-feature.json │ ├── install.sh │ └── postcreate.jl └── test └── julia ├── alpha.sh ├── lts.sh ├── scenarios.json ├── test.sh ├── version-1-6-1.sh ├── version-1-6.sh └── version-1.sh /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: "Release dev container features & Generate Documentation" 2 | on: 3 | workflow_dispatch: 4 | 5 | jobs: 6 | deploy: 7 | if: ${{ github.ref == 'refs/heads/main' }} 8 | runs-on: ubuntu-latest 9 | permissions: 10 | contents: write 11 | pull-requests: write 12 | packages: write 13 | steps: 14 | - uses: actions/checkout@v3 15 | 16 | - name: "Publish Features" 17 | uses: devcontainers/action@v1 18 | with: 19 | publish-features: "true" 20 | base-path-to-features: "./src" 21 | generate-docs: "true" 22 | features-namespace: "julialang/devcontainer-features" 23 | 24 | env: 25 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 26 | 27 | - name: Create PR for Documentation 28 | id: push_image_info 29 | env: 30 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 31 | run: | 32 | set -e 33 | echo "Start." 34 | # Configure git and Push updates 35 | git config --global user.email github-actions@github.com 36 | git config --global user.name github-actions 37 | git config pull.rebase false 38 | branch=automated-documentation-update-$GITHUB_RUN_ID 39 | git checkout -b $branch 40 | message='Automated documentation update' 41 | # Add / update and commit 42 | git add */**/README.md 43 | git commit -m 'Automated documentation update [skip ci]' || export NO_UPDATES=true 44 | # Push 45 | if [ "$NO_UPDATES" != "true" ] ; then 46 | git push origin "$branch" 47 | gh pr create --title "$message" --body "$message" 48 | fi 49 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: "CI - Test Features" 2 | on: 3 | push: 4 | branches: 5 | - main 6 | pull_request: 7 | workflow_dispatch: 8 | 9 | jobs: 10 | test-autogenerated: 11 | runs-on: ubuntu-latest 12 | continue-on-error: true 13 | strategy: 14 | matrix: 15 | features: 16 | - julia 17 | baseImage: 18 | - debian:latest 19 | - ubuntu:latest 20 | - mcr.microsoft.com/devcontainers/base:debian 21 | - mcr.microsoft.com/devcontainers/base:ubuntu 22 | steps: 23 | - uses: actions/checkout@v3 24 | 25 | - name: "Install latest devcontainer CLI" 26 | run: npm install -g @devcontainers/cli 27 | 28 | - name: "Generating tests for '${{ matrix.features }}' against '${{ matrix.baseImage }}'" 29 | run: devcontainer features test --skip-scenarios -f ${{ matrix.features }} -i ${{ matrix.baseImage }} . 30 | 31 | test-scenarios: 32 | runs-on: ubuntu-latest 33 | continue-on-error: true 34 | strategy: 35 | matrix: 36 | features: 37 | - julia 38 | steps: 39 | - uses: actions/checkout@v3 40 | 41 | - name: "Install latest devcontainer CLI" 42 | run: npm install -g @devcontainers/cli 43 | 44 | - name: "Generating tests for '${{ matrix.features }}' scenarios" 45 | run: devcontainer features test -f ${{ matrix.features }} --skip-autogenerated . 46 | 47 | test-global: 48 | runs-on: ubuntu-latest 49 | continue-on-error: true 50 | steps: 51 | - uses: actions/checkout@v3 52 | 53 | - name: "Install latest devcontainer CLI" 54 | run: npm install -g @devcontainers/cli 55 | 56 | - name: "Testing global scenarios" 57 | run: devcontainer features test --global-scenarios-only . 58 | -------------------------------------------------------------------------------- /.github/workflows/validate.yml: -------------------------------------------------------------------------------- 1 | name: "Validate devcontainer-feature.json files" 2 | on: 3 | workflow_dispatch: 4 | pull_request: 5 | 6 | jobs: 7 | validate: 8 | runs-on: ubuntu-latest 9 | steps: 10 | - uses: actions/checkout@v3 11 | 12 | - name: "Validate devcontainer-feature.json files" 13 | uses: devcontainers/action@v1 14 | with: 15 | validate-only: "true" 16 | base-path-to-features: "./src" 17 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Julia Development Container Feature 2 | 3 | Installs the Julia programming language into a [development container](https://containers.dev/). 4 | 5 | ## Example Usage 6 | 7 | ```json 8 | "features": { 9 | "ghcr.io/julialang/devcontainer-features/julia:1": {} 10 | } 11 | ``` 12 | 13 | ## Options 14 | 15 | You can select a specific Julia version by specifying a [Juliaup](https://github.com/julialang/juliaup) channel name as an option. For example, the following installs the LTS Julia release: 16 | 17 | ```json 18 | "features": { 19 | "ghcr.io/julialang/devcontainer-features/julia:1": { 20 | "channel": "lts" 21 | } 22 | } 23 | ``` 24 | -------------------------------------------------------------------------------- /src/julia/NOTES.md: -------------------------------------------------------------------------------- 1 | ## Options 2 | 3 | You can select a specific Julia version by specifying a [Juliaup](https://github.com/julialang/juliaup) channel name as an option. For example, the following installs the LTS Julia release: 4 | 5 | ```json 6 | "features": { 7 | "ghcr.io/julialang/devcontainer-features/julia:1": { 8 | "channel": "lts" 9 | } 10 | } 11 | ``` 12 | 13 | `channel` can be also specified as a Julia version, such as `1.5.4`, `1.5`, `1`. 14 | Check the Juliaup documentation for details. 15 | -------------------------------------------------------------------------------- /src/julia/README.md: -------------------------------------------------------------------------------- 1 | 2 | # Julia (via Juliaup) (julia) 3 | 4 | Install the Julia programming language 5 | 6 | ## Example Usage 7 | 8 | ```json 9 | "features": { 10 | "ghcr.io/julialang/devcontainer-features/julia:1": {} 11 | } 12 | ``` 13 | 14 | ## Options 15 | 16 | | Options Id | Description | Type | Default Value | 17 | |-----|-----|-----|-----| 18 | | channel | Select a Juliaup channel | string | release | 19 | 20 | ## Customizations 21 | 22 | ### VS Code Extensions 23 | 24 | - `julialang.language-julia` 25 | - `tamasfe.even-better-toml` 26 | 27 | ## Options 28 | 29 | You can select a specific Julia version by specifying a [Juliaup](https://github.com/julialang/juliaup) channel name as an option. For example, the following installs the LTS Julia release: 30 | 31 | ```json 32 | "features": { 33 | "ghcr.io/julialang/devcontainer-features/julia:1": { 34 | "channel": "lts" 35 | } 36 | } 37 | ``` 38 | 39 | `channel` can be also specified as a Julia version, such as `1.5.4`, `1.5`, `1`. 40 | Check the Juliaup documentation for details. 41 | 42 | 43 | --- 44 | 45 | _Note: This file was auto-generated from the [devcontainer-feature.json](https://github.com/JuliaLang/devcontainer-features/blob/main/src/julia/devcontainer-feature.json). Add additional notes to a `NOTES.md`._ 46 | -------------------------------------------------------------------------------- /src/julia/devcontainer-feature.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Julia (via Juliaup)", 3 | "id": "julia", 4 | "version": "1.1.1", 5 | "description": "Install the Julia programming language", 6 | "documentationURL": "https://github.com/JuliaLang/devcontainer-features/tree/main/src/julia", 7 | "options": { 8 | "channel": { 9 | "type": "string", 10 | "proposals": [ 11 | "release", 12 | "lts" 13 | ], 14 | "default": "release", 15 | "description": "Select a Juliaup channel" 16 | } 17 | }, 18 | "installsAfter": [ 19 | "ghcr.io/devcontainers/features/common-utils" 20 | ], 21 | "postCreateCommand": { 22 | "julia-activate": "/usr/local/julia-devcontainer-features/postcreate.jl" 23 | }, 24 | "customizations": { 25 | "vscode": { 26 | "extensions": [ 27 | "julialang.language-julia", 28 | "tamasfe.even-better-toml" 29 | ] 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/julia/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | CHANNEL=${CHANNEL:-"release"} 4 | 5 | USERNAME=${USERNAME:-${_REMOTE_USER:-"automatic"}} 6 | 7 | set -e 8 | 9 | if [ "$(id -u)" -ne 0 ]; then 10 | echo -e 'Script must be run as root. Use sudo, su, or add "USER root" to your Dockerfile before running this script.' 11 | exit 1 12 | fi 13 | 14 | # Determine the appropriate non-root user 15 | if [ "${USERNAME}" = "auto" ] || [ "${USERNAME}" = "automatic" ]; then 16 | USERNAME="" 17 | POSSIBLE_USERS=("vscode" "node" "codespace" "$(awk -v val=1000 -F ":" '$3==val{print $1}' /etc/passwd)") 18 | for CURRENT_USER in "${POSSIBLE_USERS[@]}"; do 19 | if id -u "${CURRENT_USER}" >/dev/null 2>&1; then 20 | USERNAME=${CURRENT_USER} 21 | break 22 | fi 23 | done 24 | if [ "${USERNAME}" = "" ]; then 25 | USERNAME=root 26 | fi 27 | elif [ "${USERNAME}" = "none" ] || ! id -u "${USERNAME}" >/dev/null 2>&1; then 28 | USERNAME=root 29 | fi 30 | 31 | cleanup_apt() { 32 | # shellcheck source=/dev/null 33 | source /etc/os-release 34 | if [ "${ID}" = "debian" ] || [ "${ID_LIKE}" = "debian" ]; then 35 | rm -rf /var/lib/apt/lists/* 36 | fi 37 | } 38 | 39 | # Checks if packages are installed and installs them if not 40 | check_packages() { 41 | if ! dpkg -s "$@" > /dev/null 2>&1; then 42 | if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then 43 | echo "Running apt-get update..." 44 | apt-get update -y 45 | fi 46 | apt-get -y install --no-install-recommends "$@" 47 | fi 48 | } 49 | 50 | export DEBIAN_FRONTEND=noninteractive 51 | 52 | cleanup_apt 53 | check_packages curl ca-certificates 54 | 55 | su "${USERNAME}" -c "curl -fsSL https://install.julialang.org | sh -s -- --yes --default-channel ${CHANNEL}" 56 | 57 | # Clean up 58 | cleanup_apt 59 | 60 | # Copy postcreate.jl into the container 61 | echo "Copying postcreate.jl into the container..." 62 | SCRIPT_DIR=/usr/local/julia-devcontainer-features/ 63 | mkdir -p "${SCRIPT_DIR}" 64 | cp postcreate.jl "${SCRIPT_DIR}/" 65 | 66 | echo "Done!" 67 | -------------------------------------------------------------------------------- /src/julia/postcreate.jl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env julia 2 | 3 | using Pkg 4 | 5 | function has_manifest_file() 6 | return isfile(joinpath(pwd(),"Manifest.toml")) || isfile(joinpath(pwd(),"JuliaManifest.toml")) 7 | end 8 | 9 | function has_project_file() 10 | return isfile(joinpath(pwd(),"Project.toml")) || isfile(joinpath(pwd(),"JuliaProject.toml")) 11 | end 12 | 13 | function is_package() 14 | return has_project_file() && !has_manifest_file() 15 | end 16 | 17 | function is_app() 18 | return has_project_file() && has_manifest_file() 19 | end 20 | 21 | if is_app() 22 | Pkg.activate(pwd()) 23 | Pkg.instantiate() 24 | elseif is_package() 25 | Pkg.develop(path=pwd()) 26 | end 27 | -------------------------------------------------------------------------------- /test/julia/alpha.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | # shellcheck source=/dev/null 6 | source dev-container-features-test-lib 7 | 8 | # Feature-specific tests 9 | check "version" julia --version 10 | 11 | # Report result 12 | reportResults 13 | -------------------------------------------------------------------------------- /test/julia/lts.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | # shellcheck source=/dev/null 6 | source dev-container-features-test-lib 7 | 8 | # Feature-specific tests 9 | check "version" julia --version 10 | 11 | # Report result 12 | reportResults 13 | -------------------------------------------------------------------------------- /test/julia/scenarios.json: -------------------------------------------------------------------------------- 1 | { 2 | "version-1-6-1": { 3 | "image": "debian:stable-slim", 4 | "features": { 5 | "julia": { 6 | "channel": "1.6.1" 7 | } 8 | } 9 | }, 10 | "version-1-6": { 11 | "image": "debian:stable-slim", 12 | "features": { 13 | "julia": { 14 | "channel": "1.6" 15 | } 16 | } 17 | }, 18 | "version-1": { 19 | "image": "debian:stable-slim", 20 | "features": { 21 | "julia": { 22 | "channel": "1" 23 | } 24 | } 25 | }, 26 | "alpha": { 27 | "image": "debian:stable-slim", 28 | "features": { 29 | "julia": { 30 | "channel": "alpha" 31 | } 32 | } 33 | }, 34 | "lts": { 35 | "image": "debian:stable-slim", 36 | "features": { 37 | "julia": { 38 | "channel": "lts" 39 | } 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /test/julia/test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | # shellcheck source=/dev/null 6 | source dev-container-features-test-lib 7 | 8 | # Feature-specific tests 9 | check "version" julia --version 10 | 11 | # Report result 12 | reportResults 13 | -------------------------------------------------------------------------------- /test/julia/version-1-6-1.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | # shellcheck source=/dev/null 6 | source dev-container-features-test-lib 7 | 8 | # Feature-specific tests 9 | check "version" julia --version | grep "1.6.1" 10 | 11 | # Report result 12 | reportResults 13 | -------------------------------------------------------------------------------- /test/julia/version-1-6.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | # shellcheck source=/dev/null 6 | source dev-container-features-test-lib 7 | 8 | # Feature-specific tests 9 | check "version" julia --version | grep "1.6." 10 | 11 | # Report result 12 | reportResults 13 | -------------------------------------------------------------------------------- /test/julia/version-1.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | # shellcheck source=/dev/null 6 | source dev-container-features-test-lib 7 | 8 | # Feature-specific tests 9 | check "version" julia --version | grep "1." 10 | 11 | # Report result 12 | reportResults 13 | --------------------------------------------------------------------------------