Compare commits

..

183 commits

Author SHA1 Message Date
768d4c8398 Удалить .woodpecker.yaml 2024-01-05 04:35:25 +03:00
0a4f338966 Обновить .woodpecker.yaml
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
2024-01-05 04:34:48 +03:00
297c9da2d8 Обновить .woodpecker.yaml 2024-01-05 04:33:19 +03:00
f0abbb5ccd Обновить .woodpecker.yaml 2024-01-05 04:32:46 +03:00
fd426c9ceb Обновить .woodpecker.yaml 2024-01-05 04:31:51 +03:00
dfb174d4e4 Добавить .woodpecker.yaml 2024-01-05 04:31:32 +03:00
Josh Spicer
3ea4d6bbd7
Fix .zprofile is owned by root (#775)
* revert behavior of sourcing .profile in .zprofile

https://github.com/devcontainers/features/pull/736/files#diff-3e71c0a0669a0410f7dd0d8f2b83f3b6bf6b525d3eabd354f19f32822da669fcR460-R463

* add test

* increment version

* create empty .zprofile is not present, and fix test

* temporarily add back .profile to .zprofile (only if file did not exist)
2023-12-07 10:49:18 -08:00
Philipp Wagner
def3a41f57
Fix common-utils installation on RHEL (and friends) (#772)
* Fix indentation in common-utils/main.sh

* common-utils: Fix install error on RHEL

On RHEL (and derivatives) the installation of the common-utils feature
could fail if the feature ran before (i.e., `PACKAGES_ALREADY_INSTALLED`
is set) and if either `INSTALL_ZSH` is false, or zsh was installed
earlier and `ZSH_ALREADY_INSTALLED` is true.

In these cases the script the `package_list` is empty, and `dnf`
terminates with the following error message:

```
usage: dnf install [-c [config file]] [-q] [-v] [--version]
                   [--installroot [path]] [--nodocs] [--noplugins]
                   [--enableplugin [plugin]] [--disableplugin [plugin]]
                   [--releasever RELEASEVER] [--setopt SETOPTS]
                   [--skip-broken] [-h] [--allowerasing] [-b | --nobest] [-C]
                   [-R [minutes]] [-d [debug level]] [--debugsolver]
                   [--showduplicates] [-e ERRORLEVEL] [--obsoletes]
                   [--rpmverbosity [debug level name]] [-y] [--assumeno]
                   [--enablerepo [repo]] [--disablerepo [repo] | --repo
                   [repo]] [--enable | --disable] [-x [package]]
                   [--disableexcludes [repo]] [--repofrompath [repo,path]]
                   [--noautoremove] [--nogpgcheck] [--color COLOR] [--refresh]
                   [-4] [-6] [--destdir DESTDIR] [--downloadonly]
                   [--comment COMMENT] [--bugfix] [--enhancement]
                   [--newpackage] [--security] [--advisory ADVISORY]
                   [--bz BUGZILLA] [--cve CVES]
                   [--sec-severity {Critical,Important,Moderate,Low}]
                   [--forcearch ARCH]
                   PACKAGE [PACKAGE ...]
dnf install: error: the following arguments are required: PACKAGE
```

Fix the problem by running `dnf` only with a non-zero `package_list`.
2023-12-05 17:02:58 -08:00
Dev containers Bot
d53b9d1816
[Updates] Automated vendor dotnet-install script (#750)
* Automated dotnet-install script update

* Bump version

---------

Co-authored-by: github-actions <github-actions@github.com>
2023-11-14 09:56:03 -08:00
Dev containers Bot
710103a638
Automated documentation update (#738)
Automated documentation update [skip ci]

Co-authored-by: github-actions <github-actions@github.com>
2023-10-30 10:20:06 -07:00
Oscar
7324b6d03c
Remove rebornix.Ruby extension (#737)
Remove the deprecated rebornix.Ruby extension from the list of installed extensions.
2023-10-30 10:16:28 -07:00
Samruddhi Khandale
d4ecc7be06
Update Features - Remove use of get_common_setting (#735) 2023-10-27 15:47:44 -07:00
Samruddhi Khandale
719901a1b4
[common-utils] Bug fix: zsh missing rc snippet (#736)
* [common-utils] Bug fix: zsp missing rc snippet

* condion rc snippet

* fix bug

* remove debugging step
2023-10-27 15:47:26 -07:00
Dev containers Bot
4c2c9f7b95
Automated documentation update (#732)
Automated documentation update [skip ci]

Co-authored-by: github-actions <github-actions@github.com>
2023-10-23 16:14:35 -07:00
Lyon Till
e645120a39
Add PowerShell extension (#731)
* Add PowerShell extension

* Bump feature version
2023-10-23 16:08:27 -07:00
Richard Höchenberger
1155a9906b
Try connecting to Ubuntu keyserver on port 80 if default HKP port fails (#722)
* Try Ubuntu keyserver on port 80 if default HKP port fails

Closes #719
Closes #717

* Bump feature versions

---------

Co-authored-by: Samruddhi Khandale <skhandale@microsoft.com>
2023-10-17 23:45:04 +00:00
Samruddhi Khandale
36a3604b90
[Python] - Support 3.12 (#726) 2023-10-17 15:05:01 -07:00
Samruddhi Khandale
4fca96b5e8
[Docker-in-docker] Updates docker-init scripts (#715)
* updates

* version bump
2023-10-05 11:27:01 -07:00
Jan-Marco Edelmann
0d7ad7c5fc
Configure npm proxy when proxy environmentals exist (#712) 2023-10-04 15:09:35 -07:00
Alexander Smolyakov
90a9b1d604
[terraform] Update retry logic to handle DNS-related errors more gracefully (#713)
* [terraform] Update retry logic

- Add `dnsutils` package to dependencies
- Update retry logic to handle DNS-related errors more gracefully

* Update install.sh

* Bump version
2023-10-04 10:00:11 -07:00
Luciana Abud
c3f9105048
Remove deprecated Python settings (#625)
* Remove deprecated Python settings

* No longer install Python linters and formatters

* Revert "No longer install Python linters and formatters"

This reverts commit 57c7bec14d.

* Bump minor version
2023-10-02 08:59:25 -07:00
Samruddhi Khandale
04cb7d1e79
Docker-in-docker: Updates docker-init with "pkill" (#711)
* Docker-in-docker: Updates docker-init with "pkill"

* pkill only if container didn't start at first

* pkill with condition

* add back sudo_if
2023-09-29 12:02:54 -07:00
Samruddhi Khandale
cf92754bf4
Automated documentation update (#709)
Automated documentation update [skip ci]

Co-authored-by: github-actions <github-actions@github.com>
2023-09-29 11:50:09 -07:00
Steven
803ec6e0e5
Bump the dotnet version after a script update (#707)
* Bump the dotnet version after a script update

* Forgot to add file

* Keep 4 spaces indentation
2023-09-28 10:50:20 -07:00
Samruddhi Khandale
0599c63f8f
[Updates] Automated vendor dotnet-install script (#698)
* Automated dotnet-install script update

* version bump

---------

Co-authored-by: github-actions <github-actions@github.com>
2023-09-28 10:08:39 -07:00
Samruddhi Khandale
3aad9a72f4
Terraform - Adds licensing information (#697)
* Terraform - Adds licensing information

* Update src/terraform/NOTES.md

Co-authored-by: Brigit Murtaugh <brigit.murtaugh@microsoft.com>

---------

Co-authored-by: Brigit Murtaugh <brigit.murtaugh@microsoft.com>
2023-09-28 09:59:04 -07:00
Masahiro Wada
243671eece
Enhancements in CUDA Support (#699)
* add cuda tookit installing support

* add nvcc installing support

* add libcudnn8-dev installing support

* add new cuda versions adn cudnn versions

* add specificaitons of new option

* remove installNvcc

installNvcc process is included in installToolkit

* add tests for new nvidia-cuda options

* fix wrong scenario name

* Revert "add specificaitons of new option"

This reverts commit 0dcdb92406.

README.md should be generated by CI workflow.

* make cudnn-dev installation isolated

* dump minor version to 1.1.0
2023-09-27 12:17:31 -07:00
Alexander Smolyakov
0d2fc3ad5b
[python] Change the sudo_if function to avoid issues with Bash (#694)
* [python] Updated `sudo_if` function

- Remove double quotes to avoid issues with string tokenization

* Add test scenario

* Revert "Add test scenario"

This reverts commit 9e62a3797a.

* Update `jupyterlab git` package name

* Bump feature version

* Test: Install jupyterlab under root user

* Refactor changes

* Bump patch version

* Address review points
2023-09-27 11:51:26 -07:00
Pablo Ulloa
e7f7d194d6
[common-utils] fix bug when user home is custom by base docker (#703)
* [common-utils] fix bug when user home is custom by base docker

* bumped minor version

* reduced conditions to improve readability
2023-09-27 11:45:29 -07:00
Pablo Ulloa
9852ca8888
[java] fix version regex to support graalce jdk 21 (#701)
* [java] fixed feature test scenario check

* [java] support for non conentional version

* Update src/java/install.sh to not include whitespaces

Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com>

* bumped patch version

---------

Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com>
2023-09-27 09:26:53 -07:00
Steven
3a22c41940
Configure environment for update-dotnet-install-script.yml (#693) 2023-09-19 09:58:33 -07:00
Samruddhi Khandale
f92f7ba7ae
[common-utils]: Bug fix: Install zsh on an image previously built with "installZsh:false" (#649)
* [common-utils]: Bug fix: Installs zsh on an image built with installZsh:false

* version bump

* nit: fix merge conflicts

* Version bump
2023-09-14 09:05:50 -07:00
Samruddhi Khandale
97eea5deee
[Go] Update proposals for the "version" option (#654)
Update devcontainer-feature.json
2023-09-13 08:42:41 -07:00
Samruddhi Khandale
a771e8cb42
[Docker-in-docker] Support bookworm (#661)
* [Docker-in-docker] Support bookworm

* Update devcontainer-feature.json
2023-09-11 11:32:53 -07:00
Samruddhi Khandale
8ad7c749b3
Automated documentation update (#688)
Automated documentation update [skip ci]

Co-authored-by: github-actions <github-actions@github.com>
2023-09-11 11:28:49 -07:00
Steven
96c1eea40f
Use dotnet-install.sh in .NET feature (#628)
* Use dotnet-install.sh in .NET feature

* Use latest.version files

* Cleanup runtime args

* Use latest.version files in tests as well

* Improve tests, remove code duplication

* Add stderr helper

* Validate version inputs

* Use suggested description

Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com>

* Shorter version description

Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com>

* Shorter version description

Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com>

* Clean up apt lists

* Verify 7.0 is latest

* Fix PATH, add test for .NET global tools

* Include a copy of dotnet-install.sh in the Feature

* Configure useful env variables

* Use stringly typed booleans

* Keep imperative writing style in option hints

* Update maintainers

Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com>

* Move dotnet-install.sh into a vendor directory

* Refactor variables

* Amend

* Amend 2

* Use default options from devcontainer-feature.json

* Add back variables

* Fix shellchek warning in fetch_latest_sdk_version

* Inline install_version function

* Fix ShellCheck warnings

* Improve CSV parsing

* Default to latest when configuring an empty version

* Add support for runtime-only configurations

* Move 'none' check higher up

* Deduplicate helper functions, sort into files

* Address the user more directly in NOTES

* Remove unnecessary defaults

* Replace feature -> Feature

Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com>

* Add update-dotnet-install-script workflow

* Apply suggestions from code review

Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com>

* Don't skip ci for automated script update

---------

Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com>
2023-09-11 11:16:24 -07:00
eitsupi
038bed3d58
ci: remove ubuntu:bionic from test matrixes (#677)
ci: remove ubuntu:bionic from test matrixes
2023-08-29 09:32:46 -07:00
Samruddhi Khandale
96bff00970
Automated documentation update (#676)
Automated documentation update [skip ci]

Co-authored-by: github-actions <github-actions@github.com>
2023-08-28 15:15:43 -07:00
eitsupi
95a169b9ef
[node] Install the latest version of nvm by default (#673)
feat(node): install the latest nvm by default
2023-08-28 14:26:30 -07:00
naturedamends
0668db5ede
Commonutils: chown: cannot access '/home/vscode/.zshrc': No such file or directory (#662)
* Update main.sh

* Update devcontainer-feature.json

* Test install as non root user.

---------

Co-authored-by: Samruddhi Khandale <skhandale@microsoft.com>
2023-08-25 16:39:32 -07:00
Samruddhi Khandale
0cf690ee14
[docker in docker] Adds retries for docker daemon startup and cgroup nesting (#669)
* adds retry logic

* adds stress test workflow

* Adds cgroup retries

* update workflow

* move sleep cmd

* update test

* cleanup
2023-08-24 12:31:40 -07:00
nyuyuyu
a08434f2b1
[Rust] Remove mutantdino.resourcemonitor extension (#665)
* Remove `mutantdino.resourcemonitor` extension

* Bump version

* Revert "Bump version"

This reverts commit e9c514911d.

* Bump version
2023-08-24 09:38:40 -07:00
Bulat Khusnimardanov
71ac2021e1
Enhancing Terraform Feature Stability (#657)
* Added fallback method to retrieve cosign version

* Update src/terraform/install.sh

Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com>

* Remove get_cosign_latest_version function

---------

Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com>
2023-08-21 17:31:20 -07:00
Samruddhi Khandale
a4b31f314f
[docker-in-docker] Reverts the retry logic (#659)
* Update install.sh

* [docker-in-docker] Update retry logic

* revert the retry logic!
2023-08-18 16:01:50 -07:00
Samruddhi Khandale
9fd5daf06b
Automated documentation update (#656)
Automated documentation update [skip ci]

Co-authored-by: github-actions <github-actions@github.com>
2023-08-16 11:43:06 -07:00
Samruddhi Khandale
c58b614202
Azure-cli: Revert temporary fix which installed az with python (#629) 2023-08-16 11:38:49 -07:00
Samruddhi Khandale
1d1a23625d
Ruby Feature [bug fix] : Fails if the dev container has the same ruby version installed (#609)
* Ruby Feature [bug fix] : Fails if the dev container has the same ruby version installed

* add comment

* remove scenario
2023-08-16 11:38:35 -07:00
Samruddhi Khandale
f90cb26c7f
Common-utils: Fixes "No package jq available" errors for CentOS (#644)
* add checks for "jq"

* install epel-release if necessary

* clean up epel-release post installation of "jq"
2023-08-14 16:12:47 -07:00
Samruddhi Khandale
8b6f088256
Automated documentation update (#650)
Automated documentation update [skip ci]

Co-authored-by: github-actions <github-actions@github.com>
2023-08-11 16:17:50 -07:00
naturedamends
be082b0ef5
Common utils: Add config to remove zsh rc files from (#614)
* Add config to remove zsh rc files from common-utils.

* Bump version and add config to install script.

* Checks preventing excess writing to .zshrc.

* Change devcontainer feature option name.

* Coding standards.

* Favour adding feature via config 

and default to overriding .zshrc with dev-container default template.

* Update devcontainer-feature.json

* Update devcontainer-feature.json

* Update src/common-utils/devcontainer-feature.json

Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com>

* Update src/common-utils/devcontainer-feature.json

Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com>

* Testing for using devcontainer .zshrc template file.

* Coding standards.

* Coding standards.

* Update configure_zsh_as_default_shell_no_template.sh

* Grammar in configure_zsh_as_default_shell.sh

* Testing accounts for marked file cache  (#4)

* Account for mark file in testing.

* Remove some debugging and tests back

* Add back tests?

* Update configure_zsh_no_template.sh

---------

Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com>
2023-08-11 16:01:57 -07:00
Shikanime Deva
9e75db9a1d
Avoid unexpected shell expansion (#645)
* Avoid unexpected shell expansion

* Add install Node with ZSH as default test

* Fix LTS only work on >bionic

* Bump Node feature version

* Remove huge universal image on scenarios
2023-08-09 16:20:27 -07:00
Samruddhi Khandale
f2594c5cc8
Automated documentation update (#642)
Automated documentation update [skip ci]

Co-authored-by: github-actions <github-actions@github.com>
2023-08-07 16:29:54 -07:00
Samruddhi Khandale
bbb24d10d4
Docker-in-docker: Add retries to the docker-init script until docker daemon starts (#637)
* Docker-in-docker: Add retries until docker daemon starts

* address comments
2023-08-07 15:59:58 -07:00
Tom Palmer
29859aff28
Fix 2 instances of a typo in the desktop-lite NOTES and README (#640)
* Amend 'is installed is' to 'installed is'.

* Undo typo fix from README

Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com>

---------

Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com>
2023-08-07 15:12:13 -07:00
Krikchai Pongtaveewould
685fa2e0f1
Fix: common-utils configureZshAsDefaultShell option not working on alpine linux image (#557)
* alpine defaultZsh fix

* common-utils: replace pam.d/chsh permission with `sufficient`

* common-utils: revert match auth sufficient

* common-utils: append auth string instead of replacing a whole file

* fix grep 2nd param

* fix: line checking condition
2023-08-02 15:12:14 -07:00
Samruddhi Khandale
836ea1e9fa
Automated documentation update (#627)
Automated documentation update [skip ci]

Co-authored-by: github-actions <github-actions@github.com>
2023-07-26 14:43:43 -07:00
Samruddhi Khandale
ea2d79070e
Azure-cli - Temporary quick fix for jammy (ARM) (#626) 2023-07-21 17:37:10 -07:00
Samruddhi Khandale
7fcec6e7c9
Fix: Docker-in-docker for python - Arm64 (#618)
Fix: Docker-in-docker for python:3.11 - Arm64
2023-07-19 08:50:22 -07:00
Samruddhi Khandale
0e8940abea
Automated documentation update (#610)
Automated documentation update [skip ci]

Co-authored-by: github-actions <github-actions@github.com>
2023-07-11 12:50:29 -07:00
Samruddhi Khandale
07693965d7
Nvidia-cuda: Update notes regarding gpu enablement (#608)
* Nvidia-cuda: Update notes regarding gpu enablement

* use GPU hostRequirements instead

* nit

* use gpu:optional instead
2023-07-11 11:16:23 -07:00
Kazuma Watanabe
c4ffeebdac
Pin version of TFLint's GPG key URL (#605) 2023-07-06 10:23:36 -07:00
Samruddhi Khandale
300814be97
Dotnet: Fix Feature failures on ubuntu:jammy (when installing using apt) (#590)
* fix several bugs

* fix test: .NET is now installed from ubuntu feeds

* add comment ; use dev containers image

* address comments

* revert debugging cmd

* fix test for bookworm
2023-06-29 15:14:11 -07:00
Samruddhi Khandale
8a51aa9066
Automated documentation update (#602)
Automated documentation update [skip ci]

Co-authored-by: github-actions <github-actions@github.com>
2023-06-29 15:08:34 -07:00
Rafael Mendonça França
ef76ff97b6
Change Ruby extension to ruby-lsp (#566)
This is the extension that is recommended in the VSCode documentation now.

https://code.visualstudio.com/docs/languages/ruby
2023-06-29 15:00:56 -07:00
dependabot[bot]
b6dbe7051c
Bump mpmath from 1.2.1 to 1.3.0 in /test/oryx/sample-python (#554)
Bumps [mpmath](https://github.com/fredrik-johansson/mpmath) from 1.2.1 to 1.3.0.
- [Release notes](https://github.com/fredrik-johansson/mpmath/releases)
- [Changelog](https://github.com/mpmath/mpmath/blob/master/CHANGES)
- [Commits](https://github.com/fredrik-johansson/mpmath/compare/1.2.1...1.3.0)

---
updated-dependencies:
- dependency-name: mpmath
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-28 16:16:30 -07:00
Samruddhi Khandale
610286c369
Automated documentation update (#596)
Automated documentation update [skip ci]

Co-authored-by: github-actions <github-actions@github.com>
2023-06-28 14:17:06 -07:00
Melissa Weber Mendonça
972fdffa71
Add instructions to set up port forwarding on devcontainer.json file (#593) 2023-06-28 09:17:04 -07:00
Josh Spicer
ccce957d7e
Azure CLI: Compatibility with Debian bookworm (#578)
* add flag

* try to install via apt version of pipx (will only work on bookworm)

* _REMOTE_USER aware

* dont change more than you need to,josh

* increment azure-cli minor version (v1.1.0)

* install globally

* make sure env variables are in scope
2023-06-27 14:31:18 -07:00
Samruddhi Khandale
de40074875
Automated documentation update (#587)
Automated documentation update [skip ci]

Co-authored-by: github-actions <github-actions@github.com>
2023-06-23 16:16:30 -07:00
Josh Spicer
d934503a05
Terraform: Add cosign integrity check for TFLint (#586)
* add cosign integrity check for tflint

* fallback to gpg verification
2023-06-21 11:13:46 -07:00
Imamuzzaki Abu Salam
2258fcb040
feat(rust): add up to version 1.70 options (#579) 2023-06-20 10:34:07 -07:00
Samruddhi Khandale
2fb386db11
Automated documentation update (#585)
Automated documentation update [skip ci]

Co-authored-by: github-actions <github-actions@github.com>
2023-06-19 11:33:35 -07:00
Josh Spicer
931262d20c release terraform 2023-06-19 18:24:44 +00:00
Josh Spicer
ee9f0bfbf0
Temporaily pin TFLint to 0.46.1 (#583)
temporaily pin TFLint to 0.46.1

https://github.com/devcontainers/features/issues/581
2023-06-19 11:23:49 -07:00
Josh Spicer
367308c736
Add Debian Bookworm as a test base image (#575)
test against debian bookworm
2023-06-16 14:31:40 -07:00
Samruddhi Khandale
852f1f0567
Automated documentation update (#563)
Automated documentation update [skip ci]

Co-authored-by: github-actions <github-actions@github.com>
2023-05-31 11:55:51 -07:00
Shunya Hayashi
cfae3b0f0d
update go tools (#559)
* update go tools

* update link

* add unit tests for confirm installation

* fix path install gotests

* fix bump the minor version
2023-05-31 08:53:50 -07:00
Raymond
b48d8700ff
Update NOTES.md (#534)
* Update NOTES.md

#531: Quick document update about UID & GID using 1000 in devcontainer base images.

* Update src/common-utils/NOTES.md

@samruddhikhandale The common-utils Feature is used by most of the dev container images, along with the base image. Can we update the text?

Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com>

* Update src/common-utils/NOTES.md

@samruddhikhandale

Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com>

---------

Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com>
2023-05-22 12:23:23 -07:00
Stephen A. Imhoff
1869e5931c
Create .config directory in common-utils (#547)
* Add test case for mounted subdirectory.

* Correct some trailing whitespace.

* Correct variable name to better reflect status as user home path.

* Add config directory creation.

* Remove extra debug line.

* Bump feature version.

* Mount host user home directory as "subdirectory"

* Correct test naming, run test in explicit bash shell.
2023-05-10 10:04:16 -07:00
Samruddhi Khandale
4420cd5d27
Automated documentation update (#543)
Automated documentation update [skip ci]

Co-authored-by: github-actions <github-actions@github.com>
2023-05-09 13:52:06 -07:00
M. R
4312340798
Add support for skipping docker-compose v1 operations during Docker feature install script (#533)
* Add support for skipping docker-compose operations

* Move changes from auto-generated files to templates and bump version

* Add test

* Add test conditions

* Add test conditions for docker-outside-of-docker

* install.sh set -x for debugging

* set -x

* Move compose-switch check in docker-outside-of-docker test

* Put into correct test

* Test for correct path
2023-05-02 12:00:45 -07:00
Raymond
b16ff1efb7
Update devcontainer-feature.json (#539)
#535 update the patch version to 2.0.9
2023-05-01 08:38:01 -07:00
Raymond
e2b3b48bc5
Update devcontainer-feature.json (#535)
#531 Modify proposed UID & GID so as not to conflict with base image.
2023-05-01 08:37:43 -07:00
Felix Altenberg
f52ff611c5
Adds httpProxy option to Python Feature (#532)
* Adds httpProxy option to Python Feature
This option allows GPG to use a HTTP proxy to fetch keys from remote keyservers

* Updating minor version

Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com>

* Fixes minor formatting error

---------

Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com>
2023-04-28 13:38:25 -07:00
Samruddhi Khandale
fad03b19d4
Oryx - Switch to .NET 7 (#522)
* Oryx - Switch to .NET 7

* fix test ; add test

* fix test - back compat
2023-04-18 14:37:51 -07:00
Samruddhi Khandale
2237731474
Automated documentation update (#521)
Automated documentation update [skip ci]

Co-authored-by: github-actions <github-actions@github.com>
2023-04-14 13:48:25 -07:00
Alexander Smolyakov
8d3e9aca9d
[features/conda] Address CVE-2023-0286, CVE-2023-23931, and CVE-2022-40897 vulnerabilities (#518)
* [features/conda] Address CVE-2023-0286, CVE-2023-23931, and CVE-2022-40897 vulnerabilities

- Update `install.sh` to install updates for `cryptography` and `setuptools`  packages
- Add tests to verify `cryptography` and `setuptools`  packages version

* Bump feature version
2023-04-06 10:02:49 -07:00
Samruddhi Khandale
74959ec149
Automated documentation update (#517)
Automated documentation update [skip ci]

Co-authored-by: github-actions <github-actions@github.com>
2023-04-05 16:06:27 -07:00
Ryan Campbell
585ee2a42c
Removing forced gid 999 for docker (#515)
* Removing forced gid 999 for docker

* version bump

---------

Co-authored-by: Ryan Campbell <rycampbe@microsoft.com>
Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com>
2023-04-05 12:33:00 -07:00
Felipe Santos
7f605b9452
Fix several issues with docker-outside-of-docker (#443)
* Fix several issues with docker-outside-of-docker

* Add initial tests and bump version

* Add two tests

* Fix docker buildx conflict

* Fix possible test issue

* Add tests for moby

* Add buildx test to init

* Fix inconsistency

* Many fixes and improvements

* Make dockeDashCompose v2 by default
2023-04-05 11:21:36 -07:00
Samruddhi Khandale
f0dd470ba8
Automated documentation update (#512)
Automated documentation update [skip ci]

Co-authored-by: github-actions <github-actions@github.com>
2023-04-04 10:05:12 -07:00
Josh Spicer
2952d87f1d
add a postCreateCommand to git-lfs Feature (#511)
* add a postCreateCommand to git-lfs Feature

* debug passing locally but not in CI

* update scenario

* add GIT_LFS_SKIP_SMUDGE=1 to prevent fetching lfs arifacts in github actions

* arguments should be booleans

* move example repo to devcontainers org

* place script literally anywhere other than /tmp
2023-04-04 06:47:04 -07:00
Samruddhi Khandale
1118b992d9
Ruby: Fix failures - omit "ruby-debug-ide" (#505)
* Ruby: Fix failures on debian image due to ruby-debug-ide

* omit
2023-03-28 16:05:17 -07:00
Jacob Hummer
0e079baaf7
Add contributing document (#488)
* Create CONTRIBUTING.md

* Direct questions to slack channel

Co-authored-by: Brigit Murtaugh <brigit.murtaugh@microsoft.com>

* Use "dev containers" and "Features"

Apparently devcontainers is two words, and apparently features is a proper noun? I guess 🤷‍♂️

* Prettier formatting

I used https://prettier.io/playground/ since I was editing in the GitHub web editor

* Clarify to "only accept improvements and bug fixes"

Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com>

* Be more explicit about custom features

Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com>

* Add link to CLI test docs

* Add semver step in guide

* More specificity in link text

https://github.com/devcontainers/features/pull/488#discussion_r1137819187

* Add CONTRIBUTING.md link in readme

---------

Co-authored-by: Brigit Murtaugh <brigit.murtaugh@microsoft.com>
Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com>
2023-03-23 16:07:08 -07:00
Samruddhi Khandale
e7e4aa8a98
Automated documentation update (#490)
Automated documentation update [skip ci]

Co-authored-by: github-actions <github-actions@github.com>
2023-03-14 09:17:38 -07:00
Daniel Ciborowski
d4c3fefc4a
Add pytest to Python Feature (#487)
* Update install.sh

* Update install_additional_python.sh

* Update install_os_provided_python.sh

* Update install_via_oryx.sh

* Update test.sh

* Update devcontainer-feature.json
2023-03-14 08:23:28 -07:00
Eljo George
1449f416a0
Remove duplicate env var sourcing for codespaces (#481)
* Remove duplicate env var sourcing for codespaces
2023-03-10 12:27:28 -08:00
Josh Spicer
adf7240a7c
oryx-supported-platforms (#482) 2023-03-10 08:50:32 -08:00
Samruddhi Khandale
5d6f1ae9b9
Automated documentation update (#479)
Automated documentation update [skip ci]

Co-authored-by: github-actions <github-actions@github.com>
2023-03-08 15:40:30 -08:00
Samruddhi Khandale
de1e634a67
Docker fix - BuildKit is enabled but the buildx component is missing or broken (#478)
* Docker fix - BuildKit is enabled but the buildx component is missing or broken

* nit

* fix test
2023-03-08 15:30:59 -08:00
Samruddhi Khandale
fe449253f1
Automated documentation update (#475)
Automated documentation update [skip ci]

Co-authored-by: github-actions <github-actions@github.com>
2023-03-07 11:43:06 -08:00
ksaito1125
3e6ee966ba
Terraform: Add proxy setting (#435) (#451)
* Terraform: Add proxy setting (#435)

* Terraform: Remove unused variable GPG_OPTS (#435)

* Terraform: Increment minor version (#435)

* Update src/terraform/install.sh

Co-authored-by: Samruddhi Khandale <skhandale@microsoft.com>

* Add feature option

* Update src/terraform/devcontainer-feature.json

Co-authored-by: Samruddhi Khandale <skhandale@microsoft.com>

* Update src/terraform/devcontainer-feature.json

Co-authored-by: Samruddhi Khandale <skhandale@microsoft.com>

* Update src/terraform/devcontainer-feature.json

Co-authored-by: Samruddhi Khandale <skhandale@microsoft.com>

* Terraform: Change environment variables to upper case (#435)

* Terraform: Use HTTP_PROXY as the default for connecting to keyservers (#435)

* Update src/terraform/install.sh

Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com>

---------

Co-authored-by: Samruddhi Khandale <skhandale@microsoft.com>
Co-authored-by: Samruddhi Khandale <samruddhikhandale@github.com>
2023-03-06 08:51:35 -08:00
Samruddhi Khandale
3cc059ea8a
Automated documentation update (#462)
Automated documentation update [skip ci]

Co-authored-by: github-actions <github-actions@github.com>
2023-03-01 15:54:58 -08:00
Brett Cannon
4b7efebea1
Turn off linting by default in VS Code for Python (#449)
* Turn off linting by default in VS Code for Python
Linting is on by default if you specify the paths to any linters, so the previous settings would turn on **all** linters.

Also drop linters that don't see much use.

* Fix tests

* Revert all changes

* Remove paths to under-utilized tools and turn off all linting by default

* Bump the version number
2023-03-01 15:29:11 -08:00
Akihiro Nagai
83c6103db2
Add pnpm in Node (#450)
* Add pnpm in Node

* pnpm from npm

* Restore README.md

* Update install.sh

* Update tests
2023-02-27 09:12:21 -08:00
Samruddhi Khandale
d84e46be47
"Update Documentation" workflow - use gh api to create a documentation PR (#459) 2023-02-22 12:23:22 -08:00
github-actions[bot]
8d3685e09f
Automated documentation update (#455)
Automated documentation update [skip ci]

Co-authored-by: github-actions <github-actions@github.com>
2023-02-15 12:01:23 -08:00
Stefan Drzazga
900cbfc1f9
Add sentinel to terraform feature (#452)
* Introducing Sentinel installation

* Modifying docs for sentinel

* Modifying tests for sentinel

* Revert "Modifying docs for sentinel"

This reverts commit 818894b22f.

* Modifying docs for sentinel

* Fixing duplication issue for sentinel url

* Update src/terraform/install.sh

Co-authored-by: Samruddhi Khandale <skhandale@microsoft.com>

* Increase minor version

---------

Co-authored-by: Samruddhi Khandale <skhandale@microsoft.com>
2023-02-15 11:59:31 -08:00
Samruddhi Khandale
4a9929f964
kubectl-helm-minikube: Allow none (#442) 2023-02-07 11:45:48 -08:00
Samruddhi Khandale
36d7664eba
PHP: Allow 'version:none' (#439)
* PHP: Allow 'version:none'

* fix tests
2023-02-07 09:52:33 -08:00
Samruddhi Khandale
c997f9af69
Rust - Clean up unwanted settings (#434)
* Rust - Clean up unwanted settings

* address comments
2023-02-03 09:27:17 -08:00
github-actions[bot]
6bf4a7dbec
Automated documentation update (#431)
Automated documentation update [skip ci]

Co-authored-by: github-actions <github-actions@github.com>
2023-01-30 11:42:51 -08:00
Ross Smith
7763e0b7db
Install PowerShell Modules (#427)
* InstallBicep

* Add test for InstallBicep

* Install pwsh Modules

* Script rename

* Add -Command to test

* Check version

* Install the module for all users

* Adding terminating lines to scripts

* Update src/powershell/install.sh

Co-authored-by: Samruddhi Khandale <skhandale@microsoft.com>

* Update src/powershell/install.sh

Co-authored-by: Samruddhi Khandale <skhandale@microsoft.com>

* Removed comments in Readme

* Remove Bicep from PowerShell install

* Increased version number

* Update Minor version rather than patch

---------

Co-authored-by: Samruddhi Khandale <skhandale@microsoft.com>
2023-01-30 11:29:13 -08:00
Levin Winter
fbdc4556d5
[common-utils] Fix nonempty .bashrc being restored (#421)
* [common-utils] Fix nonempty .bashrc being restored
The user's dotfiles shall only be restored to their defaults if they do
not exist or are empty. A missing negation caused the files to be
overwritten even when they were nonempty.

* [common-utils] Bump patch version after fix
Go from 2.0.7 to 2.0.8 because of backwards-compatible fix.
2023-01-25 15:57:31 -08:00
Josh Spicer
258d5029a5
Republish all Features to add repo tags (#422)
republish all features to add repo tags
2023-01-25 10:24:25 -08:00
dylhack.dev
676e824e92
features/nix: remove PGP check (#414)
* nix: remove PGP check

* fix issues
2023-01-24 10:28:54 -08:00
github-actions[bot]
3a579894a0
Automated documentation update (#417)
Automated documentation update [skip ci]

Co-authored-by: github-actions <github-actions@github.com>
2023-01-23 15:21:02 -08:00
Pamela Fox
bebf87e33c
Add more detail to note about architecture (#416)
* Add more detail to note about architecture

* Update src/docker-in-docker/NOTES.md

Co-authored-by: Samruddhi Khandale <skhandale@microsoft.com>

* Update src/docker-in-docker/NOTES.md

Co-authored-by: Samruddhi Khandale <skhandale@microsoft.com>

Co-authored-by: Samruddhi Khandale <skhandale@microsoft.com>
2023-01-23 15:18:50 -08:00
Samruddhi Khandale
7a3a9c5fca
Php: Auto configure if a three part version is not provided (#406)
* Php: Auto configure if a three part version is not provided

* fix test

* update checks

* Bump version
2023-01-20 09:22:39 -08:00
github-actions[bot]
24b33c5f79
Automated documentation update (#410)
Automated documentation update [skip ci]

Co-authored-by: github-actions <github-actions@github.com>
2023-01-18 13:42:35 -08:00
Tobias Gesellchen
d78a153492
Java: add Apache Ant (#409)
* Java: add Apache Ant

* Update src/java/devcontainer-feature.json

Co-authored-by: Samruddhi Khandale <skhandale@microsoft.com>

* revert the changes in README.md

* Add tests for Java/Ant

* Fix Java feature version

Co-authored-by: Samruddhi Khandale <skhandale@microsoft.com>
2023-01-18 13:24:10 -08:00
github-actions[bot]
f7314671e1
Automated documentation update (#405)
Automated documentation update [skip ci]

Co-authored-by: github-actions <github-actions@github.com>
2023-01-17 09:46:27 -08:00
Samruddhi Khandale
58b8fe093d
Fix typos in comments / *.md (#396) 2023-01-17 09:34:53 -08:00
Stephan
79588ef3da
checkout action update (#404)
- updated the action checkout from v2 to 3 as required by action warning
2023-01-17 09:18:13 -08:00
Stephen A. Imhoff
1726222515
CommonUtils - ensure home directory exists. (#398)
* CommonUtils - ensure home directory exists.

* Only create non-root home directory

Root directory will always exist.

* Bump version
2023-01-13 11:05:53 -08:00
Samruddhi Khandale
74dd2710dc
Git: Use sysconfdir=/etc for git built from source (#395)
* Git: Adds a new 'addGitConfigSymlink' option

* Use sysconfdir
2023-01-11 11:02:28 -08:00
Samruddhi Khandale
e67f4dc0fd
Common-utils: Fix build failures for alpine 3.14 & 3.15 (#393)
* Common-utils: Fix build failures for alpine 3.14 & 3.15

* version bump
2023-01-10 15:09:56 -08:00
github-actions[bot]
c8f5c3cbee
Automated documentation update (#394)
Automated documentation update [skip ci]

Co-authored-by: github-actions <github-actions@github.com>
2023-01-10 13:59:07 -08:00
eitsupi
7e32db56c0
[common-utils] Fix permission of scripts in containers (#388)
* fix permission in containers

* add test

* bump version

* more tests

* update tests

* Update test/common-utils/devcontainer-info/Dockerfile

Co-authored-by: Samruddhi Khandale <skhandale@microsoft.com>

* Update test/common-utils/scenarios.json

Co-authored-by: Samruddhi Khandale <skhandale@microsoft.com>

* Update scenarios.json

* Update devcontainer-info.sh

Co-authored-by: Samruddhi Khandale <skhandale@microsoft.com>
2023-01-10 13:50:09 -08:00
Samruddhi Khandale
59fa3e3c21
Conda: Update 'certifi' due to CVE-2022-23491 (#383) 2023-01-09 14:49:43 -08:00
Samruddhi Khandale
04143e31ff
Options: Switch from 'enum' to 'proposals' (#382) 2023-01-09 14:48:41 -08:00
Mark Phippard
a9a7a25d60
Install gawk RPM (#380)
* Install gawk RPM

This script requires awk and it may not be available on a
minimal distro like Mariner

* Bump version number
2023-01-05 13:21:34 -08:00
Marko Bausch
c546f4bf8c
desktop-lite: fixed qemu container (#370)
* desktop-lite: fixed qemu container

* bump version for desktop-lite
2023-01-05 09:27:12 -08:00
Samruddhi Khandale
ef192bf467
PHP: Fix build failures for 'ubuntu:bionic' (#378)
* PHP: Fix build failures for 'ubuntu:bionic'

* update VERSION
2023-01-04 14:59:24 -08:00
Julien Boudry
8f7eec80d4
[PHP] Enable Mbstring (#371)
Mbstring is such a popular PHP extension that it is used everywhere and most libraries don't work without it. It can be compiled directly with PHP.
The official Docker images of PHP include it.
2023-01-04 13:12:53 -08:00
github-actions[bot]
2c646ed9fe
Automated documentation update (#377)
Automated documentation update [skip ci]

Co-authored-by: github-actions <github-actions@github.com>
2023-01-04 11:53:48 -08:00
Samruddhi Khandale
eef35a4399
Rename "docker-from-docker" to "docker-outside-of-docker" (#373)
* Rename to "docker-outside-of-docker"

* rename test folder
2023-01-04 11:52:05 -08:00
Josh Spicer
6c76a7b488
Add validate workflow (#369)
* add validate workflow

* make typo to test 3c61c88

* remove unneeded if

* fix typo

* better names

* Update validate-metadata-files.yml
2023-01-03 14:52:56 -08:00
Samruddhi Khandale
dbf069a5db
Common-utils : Version bump (#367)
Common-utils - Version bump
2022-12-27 10:50:33 -08:00
Samruddhi Khandale
29babe4245 fix test 2022-12-27 18:35:13 +00:00
github-actions[bot]
f9de0e43f8
Automated documentation update (#368)
Automated documentation update [skip ci]

Co-authored-by: github-actions <github-actions@github.com>
2022-12-27 12:42:28 -05:00
Josh Spicer
19bc8bb633
OS support in Feature NOTES.md (#366)
* https://github.com/devcontainers/features/issues/360

* omit from common utils
2022-12-27 12:27:57 -05:00
github-actions[bot]
80ed2fbc30
Automated documentation update (#365)
Automated documentation update [skip ci]

Co-authored-by: github-actions <github-actions@github.com>
2022-12-27 09:51:25 -05:00
Josh Spicer
00dd4f4a19
remove unused buildArg in java Feature 2022-12-27 14:49:40 +00:00
Josh Spicer
592fdc8177
typo in 'dotnet' Feature schema 2022-12-27 09:36:51 -05:00
Josh Spicer
5fb5c388b5
typo 2022-12-27 09:32:34 -05:00
eitsupi
b6921f9b9f
feat(common-utils): Support the new path of meta.env file and the new field for saving source revisions (#359)
* support the new path of meta.env

* support the new field for the image revision

* minor formatting
2022-12-27 08:25:33 -05:00
Samruddhi Khandale
b9bfe406d2
Update GPG_KEY_SERVERS: Remove :80 from Ubuntu Keyserver (#354)
* Update GPG_KEY_SERVERS: Remove `:80` from Ubuntu Keyserver

* Fix ruby tests
2022-12-21 12:15:24 -08:00
Samruddhi Khandale
48678001d1
Terraform: Update GPG_KEY_SERVERS (#353)
* Terraform: Update GPG_KEY_SERVERS

* add check
2022-12-21 09:11:10 -08:00
Josh Spicer
42e5a013cc
common-utils 2.0.2 (#350)
Will release staged change: fede405549
2022-12-19 12:19:46 -05:00
github-actions[bot]
2472653c31
Automated documentation update (#351)
Automated documentation update [skip ci]

Co-authored-by: github-actions <github-actions@github.com>
2022-12-19 09:11:02 -08:00
github-actions[bot]
e46fe0eb34
Automated documentation update (#349)
Automated documentation update [skip ci]

Co-authored-by: github-actions <github-actions@github.com>
2022-12-19 11:27:18 -05:00
Mark Phippard
fede405549
Add support for mariner (#344) 2022-12-19 11:25:32 -05:00
zephyros-dev
9af65a01c7
docs: add bind mount docs for docker from docker (#343)
Co-authored-by: ptn <ptn@cct-technology.com>
2022-12-19 11:24:59 -05:00
eitsupi
7867e008c1
Fix /etc/bash.bashrc generated by common-utils (#342)
* Fix /etc/bash.bashrc generated by common-utils

* bump version
2022-12-19 11:23:05 -05:00
Samruddhi Khandale
2af02c198a
Git - Bug Fix: Feature fails with "ppa:false" for "buster" & "bullseye" (#340) 2022-12-16 16:08:37 -08:00
Samruddhi Khandale
e46c73de74
Git - Bug Fix: Feature fails with "ppa:false" for bionic & jammy (#339) 2022-12-16 14:21:05 -08:00
github-actions[bot]
a3dc31d31f
Automated documentation update (#338)
Automated documentation update [skip ci]

Co-authored-by: github-actions <github-actions@github.com>
2022-12-16 11:33:40 -08:00
Chuck Lantz
bf058dc494
Multi-distro support for common script, refactor, fixes (#326) 2022-12-16 09:47:21 -08:00
Samruddhi Khandale
7fa90110d7
Git: Build from source with USE_LIBPCRE (#331) 2022-12-13 14:09:16 -08:00
github-actions[bot]
baf47e22b0
Automated documentation update (#332)
Automated documentation update [skip ci]

Co-authored-by: github-actions <github-actions@github.com>
2022-12-13 10:59:48 -08:00
Pierre-Emmanuel Mercier
84f3e62d1c
Add TFSec and Terraform Docs to Terraform features (#327)
* Add TFSec and Terraform Docs

* PR Review

* code review
2022-12-13 10:58:22 -08:00
github-actions[bot]
7b009e661f
Automated documentation update (#328)
Automated documentation update [skip ci]

Co-authored-by: github-actions <github-actions@github.com>
2022-12-09 14:10:41 -08:00
Jacob Woffenden
aae9de7ebc
Change default shell if installing ZSH (#325)
* Added new option to configure zsh as default shell
Added test scenario
Bumped feature version

* Update test/common-utils/scenarios.json

Co-authored-by: Samruddhi Khandale <skhandale@microsoft.com>

* Update src/common-utils/devcontainer-feature.json

Co-authored-by: Samruddhi Khandale <skhandale@microsoft.com>

* Update test/common-utils/configure_zsh_as_default_shell.sh

Co-authored-by: Samruddhi Khandale <skhandale@microsoft.com>

Co-authored-by: Samruddhi Khandale <skhandale@microsoft.com>
2022-12-09 14:08:20 -08:00
Josh Spicer
e28358e33b
revert accidental push 2022-12-02 11:53:32 -08:00
Josh Spicer
779fa44930
add 'vim' as a common util to install 2022-12-02 11:52:53 -08:00
Samruddhi Khandale
57e15bc8e8
Update docker-in-docker version (#320)
update dnd
2022-12-02 09:49:20 -08:00
Samruddhi Khandale
7a47fbff00
Node: Fix regression - Installing in ubuntu 18.04 (#319)
Node: Fix regression https://github.com/devcontainers/features/issues/317
2022-12-02 09:48:04 -08:00
Samruddhi Khandale
46dfa11ecd
Github cli - Adds retry logic for find git tags (#310)
* Github cli - Adds retry logic for find git tags

* re-add set -e

* address comment
2022-11-30 13:42:57 -08:00
github-actions[bot]
64f0e10fab
Automated documentation update (#315)
Automated documentation update [skip ci]

Co-authored-by: github-actions <github-actions@github.com>
2022-11-29 17:10:37 -08:00
Samruddhi Khandale
cf36e7ac3a
docker-in-docker fix : Use ${devcontainerId} for volume name (#314)
Fix
2022-11-29 17:08:10 -08:00
Chuck Lantz
d1972b4d8d
Use _REMOTE_USER when available (#264)
* Use _REMOTE_USER when available

* Update src/python/install.sh

Co-authored-by: Samruddhi Khandale <skhandale@microsoft.com>

* Update src/python/install.sh

Co-authored-by: Samruddhi Khandale <skhandale@microsoft.com>

* Fix java test issue - JDK 18 not available for the "open" distro

* Bump breakfix numbers

Co-authored-by: Samruddhi Khandale <skhandale@microsoft.com>
Co-authored-by: Josh Spicer <joshspicer@github.com>
2022-11-28 15:07:38 -08:00
Claudio Bandera
4af4c29122
Proposal for fix of #312 (#313)
* Proposal for fix of #312

This change moves the directory separator into the `PIPX_DIR` variable in order to not introduce an error in the case pipx has already been installed systemwide.

* Bump patch version of python feature to 1.0.16
2022-11-28 11:05:21 -08:00
Chuck Lantz
30f2876053
Fix bad path to systemctl (#302) 2022-11-28 10:10:56 -06:00
Samruddhi Khandale
4b3ccf36ea
Adds test coverage (#308)
* Add test coverage

* temp: debug test

* Update tests
2022-11-23 15:03:07 -08:00
github-actions[bot]
188f1ef26b
Automated documentation update (#306)
Automated documentation update [skip ci]

Co-authored-by: github-actions <github-actions@github.com>
2022-11-23 12:46:03 -08:00
Paul Yu
133b4cf23c
Optionally install Azure Bicep as part of azure-cli feature (#305)
* Adding azure-cli bicep installer to correctly install on arm64 containers

* Adding a few updates following @joshspicer's review.
2022-11-23 15:18:22 -05:00
Samruddhi Khandale
c4648ab98c
go: fix bug - Go doesn't update version if go is already installed (#303)
* go: fix bug - Go doesn't update version if go is already installed

* Update tests with bash -c
2022-11-23 09:33:50 -08:00
Ilkka Poutanen
173c7ca3c7
Install git before github-cli (#301)
* Install git before github-cli

If building a devcontainer on e.g. `debian:bullseye`, github-cli installation can fail due to git not being installed yet:

```
0 13.38 2022-11-18 13:37:19 (6.08 MB/s) - 'gh_2.20.2_linux_amd64.deb' saved [10
176698/10176698]
#0 13.38
#0 13.40 Selecting previously unselected package gh.
#0 13.41 (Reading database ... 13628 files and directories currently installed.)
#0 13.41 Preparing to unpack .../gh_2.20.2_linux_amd64.deb ...
#0 13.41 Unpacking gh (2.20.2) ...
#0 13.65 dpkg: dependency problems prevent configuration of gh:
#0 13.65  gh depends on git; however:
#0 13.65   Package git is not installed.
#0 13.65
#0 13.65 dpkg: error processing package gh (--install):
#0 13.65  dependency problems - leaving unconfigured
#0 13.66 Errors were encountered while processing:
#0 13.66  gh
#0 13.67 ERROR: Feature "GitHub CLI" (ghcr.io/devcontainers/features/github-cli)
 failed to install! Look at the documentation at https://github.com/devcontainer
s/features/tree/main/src/github-cli for help troubleshooting this error.
```

* bump version

Co-authored-by: Josh Spicer <josh@joshspicer.com>
2022-11-18 10:26:05 -08:00
Samruddhi Khandale
3fc9604dda
Oryx: Build with .NET 6 (#298)
* Oryx: Install dotnet 3.1 runtime

* fix tests

* build with .NET 6 + add tests

* add tests

* fix tests

* shellcheck: nit
2022-11-17 11:55:43 -08:00
etienne-chrp
be4f0498e4
Add Gradle and Maven version parameters to Java (#263)
* Refactor java feature tests grep syntax

The grep with pipe syntax was creating problems with the check helper

Change them in favour of process substitution syntax

* Fix java feature tests about java version

Java 18 is not available anymore in SDKMAN

Some tests asserts were generating false positives

* Add Gradle and Maven version parameters to Java
2022-11-16 16:46:30 -08:00
Samruddhi Khandale
bff3178837
Oryx: Unpin git clone from a single commit (#296) 2022-11-16 10:49:06 -08:00
Samruddhi Khandale
1e35500bda
Node: Fix bug - version set by Feature is not default (#294)
* Node:Fix bug version set by Feature is not default

* node not supported for ubuntu:bionic
2022-11-15 14:51:00 -08:00
309 changed files with 8026 additions and 2402 deletions

View file

@ -1,18 +1,17 @@
{
"image": "mcr.microsoft.com/vscode/devcontainers/javascript-node:0-18",
"remoteUser": "node",
"image": "mcr.microsoft.com/devcontainers/javascript-node:1-18",
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {}
},
"postCreateCommand": "npm install -g @devcontainers/cli",
"hostRequirements": {
"cpus": 4
},
"customizations": {
"vscode": {
"extensions": [
"mads-hartmann.bash-ide-vscode"
]
}
},
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:1": {}
},
"postCreateCommand": "npm install -g @devcontainers/cli",
"hostRequirements": {
"cpus": 4
}
}

View file

@ -0,0 +1,37 @@
name: "Stress test - Docker in Docker"
on:
pull_request:
paths:
- 'src/docker-in-docker/**'
workflow_dispatch:
jobs:
test:
strategy:
matrix:
test-pass: [ 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50 ]
fail-fast: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: "Install latest devcontainer CLI"
run: npm install -g @devcontainers/cli
- name: "Generating tests for 'docker-in-docker' which validates if docker daemon is running"
run: devcontainer features test --skip-scenarios -f docker-in-docker -i mcr.microsoft.com/devcontainers/base:ubuntu .
test-onCreate:
strategy:
matrix:
test-pass: [ 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50 ]
fail-fast: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: "Install latest devcontainer CLI"
run: npm install -g @devcontainers/cli
- name: "Generating tests for 'docker-in-docker' which validates if docker daemon is available within 'onCreateCommand'"
run: devcontainer features test -f docker-in-docker --skip-autogenerated --filter "docker_with_on_create_command"

View file

@ -9,7 +9,7 @@ jobs:
shellchecker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Shell Linter
uses: azohra/shell-linter@v0.6.0

View file

@ -15,7 +15,7 @@ jobs:
shellchecker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Shell Linter
uses: azohra/shell-linter@v0.6.0

View file

@ -10,7 +10,7 @@ jobs:
if: ${{ github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: "Publish"
uses: devcontainers/action@v1

View file

@ -18,7 +18,7 @@ jobs:
"common-utils",
"conda",
"desktop-lite",
"docker-from-docker",
"docker-outside-of-docker",
"docker-in-docker",
"dotnet",
"git",
@ -44,14 +44,13 @@ jobs:
[
"ubuntu:focal",
"ubuntu:jammy",
"ubuntu:bionic",
"debian:11",
"debian:10",
"debian:12",
"mcr.microsoft.com/devcontainers/base:ubuntu",
"mcr.microsoft.com/devcontainers/base:debian",
]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: "Install latest devcontainer CLI"
run: npm install -g @devcontainers/cli
@ -71,7 +70,7 @@ jobs:
"common-utils",
"conda",
"desktop-lite",
"docker-from-docker",
"docker-outside-of-docker",
"docker-in-docker",
"dotnet",
"git",
@ -94,7 +93,7 @@ jobs:
"nix",
]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: "Install latest devcontainer CLI"
run: npm install -g @devcontainers/cli
@ -106,7 +105,7 @@ jobs:
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: "Install latest devcontainer CLI"
run: npm install -g @devcontainers/cli

View file

@ -19,7 +19,7 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: "Install latest devcontainer CLI"
run: npm install -g @devcontainers/cli

View file

@ -3,94 +3,80 @@ on:
pull_request:
jobs:
# detect-changes:
# runs-on: ubuntu-latest
# outputs:
# features: ${{ steps.filter.outputs.changes }}
# steps:
# - uses: dorny/paths-filter@v2
# id: filter
# with:
# filters: |
# anaconda: ./**/anaconda/**
# aws-cli: ./**/aws-cli/**
# azure-cli: ./**/azure-cli/**
# common-utils: ./**/common-utils/**
# conda: ./**/conda/**
# desktop-lite: ./**/desktop-lite/**
# docker-from-docker: ./**/docker-from-docker/**
# docker-in-docker: ./**/docker-in-docker/**
# dotnet: ./**/dotnet/**
# git: ./**/git/**
# git-lfs: ./**/git-lfs/**
# github-cli: ./**/github-cli/**
# go: ./**/go/**
# hugo: ./**/hugo/**
# java: ./**/java/**
# kubectl-helm-minikube: ./**/kubectl-helm-minikube/**
# node: ./**/node/**
# nvidia-cuda: ./**/nvidia-cuda/**
# oryx: ./**/oryx/**
# php: ./**/php/**
# powershell: ./**/powershell/**
# python: ./**/python/**
# ruby: ./**/ruby/**
# rust: ./**/rust/**
# sshd: ./**/sshd/**
# terraform: ./**/terraform/**
# nix: ./**/nix/**
detect-changes:
runs-on: ubuntu-latest
outputs:
features: ${{ steps.filter.outputs.changes }}
steps:
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
anaconda: ./**/anaconda/**
aws-cli: ./**/aws-cli/**
azure-cli: ./**/azure-cli/**
common-utils: ./**/common-utils/**
conda: ./**/conda/**
desktop-lite: ./**/desktop-lite/**
docker-outside-of-docker: ./**/docker-outside-of-docker/**
docker-in-docker: ./**/docker-in-docker/**
dotnet: ./**/dotnet/**
git: ./**/git/**
git-lfs: ./**/git-lfs/**
github-cli: ./**/github-cli/**
go: ./**/go/**
hugo: ./**/hugo/**
java: ./**/java/**
kubectl-helm-minikube: ./**/kubectl-helm-minikube/**
node: ./**/node/**
nvidia-cuda: ./**/nvidia-cuda/**
oryx: ./**/oryx/**
php: ./**/php/**
powershell: ./**/powershell/**
python: ./**/python/**
ruby: ./**/ruby/**
rust: ./**/rust/**
sshd: ./**/sshd/**
terraform: ./**/terraform/**
nix: ./**/nix/**
# test:
# needs: [detect-changes]
# runs-on: ubuntu-latest
# continue-on-error: true
# strategy:
# matrix:
# features: ${{ fromJSON(needs.detect-changes.outputs.features) }}
# baseImage:
# [
# "ubuntu:focal",
# "ubuntu:jammy",
# "ubuntu:bionic",
# "debian:11",
# "debian:10",
# "mcr.microsoft.com/devcontainers/base:ubuntu",
# "mcr.microsoft.com/devcontainers/base:debian",
# ]
# steps:
# - uses: actions/checkout@v2
# - name: "Install latest devcontainer CLI"
# run: npm install -g @devcontainers/cli
# - name: "Generating tests for '${{ matrix.features }}' against '${{ matrix.baseImage }}'"
# run: devcontainer features test --skip-scenarios -f ${{ matrix.features }} -i ${{ matrix.baseImage }}
# test-scenarios:
# needs: [detect-changes]
# runs-on: ubuntu-latest
# continue-on-error: true
# strategy:
# matrix:
# features: ${{ fromJSON(needs.detect-changes.outputs.features) }}
# steps:
# - uses: actions/checkout@v2
# - name: "Install latest devcontainer CLI"
# run: npm install -g @devcontainers/cli
# - name: "Testing '${{ matrix.features }}' scenarios"
# run: devcontainer features test -f ${{ matrix.features }} --skip-autogenerated
TEMPORARY:
test:
needs: [detect-changes]
runs-on: ubuntu-latest
continue-on-error: true
strategy:
matrix:
features: ${{ fromJSON(needs.detect-changes.outputs.features) }}
baseImage:
[
"ubuntu:focal",
"ubuntu:jammy",
"debian:11",
"debian:12",
"mcr.microsoft.com/devcontainers/base:ubuntu",
"mcr.microsoft.com/devcontainers/base:debian",
]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: "Install latest devcontainer CLI"
run: npm install -g @devcontainers/cli
- name: "TEMPORARY: test install_non_root_remoteUser"
run: devcontainer features test -f dotnet --skip-autogenerated --filter install_non_root_remoteUser
- name: "Generating tests for '${{ matrix.features }}' against '${{ matrix.baseImage }}'"
run: devcontainer features test --skip-scenarios -f ${{ matrix.features }} -i ${{ matrix.baseImage }} .
test-scenarios:
needs: [detect-changes]
runs-on: ubuntu-latest
continue-on-error: true
strategy:
matrix:
features: ${{ fromJSON(needs.detect-changes.outputs.features) }}
steps:
- uses: actions/checkout@v3
- name: "Install latest devcontainer CLI"
run: npm install -g @devcontainers/cli
- name: "Testing '${{ matrix.features }}' scenarios"
run: devcontainer features test -f ${{ matrix.features }} --skip-autogenerated .

View file

@ -8,9 +8,10 @@ on:
jobs:
generate:
runs-on: ubuntu-latest
environment: documentation
if: "github.ref == 'refs/heads/main'"
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Generate Documentation
uses: devcontainers/action@v1
@ -18,10 +19,10 @@ jobs:
generate-docs: "true"
base-path-to-features: "./src"
- name: Add and Commit Documentation
- name: Create a PR for Documentation
id: push_image_info
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.PAT }}
run: |
set -e
echo "Start."
@ -42,5 +43,12 @@ jobs:
# Push
if [ "$NO_UPDATES" != "true" ] ; then
git push origin "$branch"
gh pr create --title "$message" --body "$message"
gh api \
--method POST \
-H "Accept: application/vnd.github+json" \
/repos/${GITHUB_REPOSITORY}/pulls \
-f title="$message" \
-f body="$message" \
-f head="$branch" \
-f base='main'
fi

View file

@ -0,0 +1,52 @@
name: "Updates vendor 'dotnet-install' script"
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * 0' # Runs every Sunday at midnight UTC (adjust as needed)
jobs:
fetch-latest-dotnet-install:
runs-on: ubuntu-latest
environment: documentation # grants access to secrets.PAT, for creating pull requests
steps:
- uses: actions/checkout@v3
- name: Run fetch-latest-dotnet-install.sh
run: src/dotnet/scripts/fetch-latest-dotnet-install.sh
- name: Create a PR for dotnet-install.sh
id: push_image_info
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
run: |
set -e
echo "Start."
# Configure git and Push updates
git config --global user.email github-actions@github.com
git config --global user.name github-actions
git config pull.rebase false
branch=automated-script-update-$GITHUB_RUN_ID
git checkout -b $branch
message='[Updates] Automated vendor 'dotnet-install' script'
# Add / update and commit
git add src/dotnet/scripts/vendor/dotnet-install.sh
git commit -m 'Automated dotnet-install script update' || export NO_UPDATES=true
# Bump version and push
if [ "$NO_UPDATES" != "true" ] ; then
echo "$(jq --indent 4 '.version = (.version | split(".") | map(tonumber) | .[2] += 1 | join("."))' src/dotnet/devcontainer-feature.json)" > src/dotnet/devcontainer-feature.json
git add src/dotnet/devcontainer-feature.json
git commit -m 'Bump version'
git push origin "$branch"
gh api \
--method POST \
-H "Accept: application/vnd.github+json" \
/repos/${GITHUB_REPOSITORY}/pulls \
-f title="$message" \
-f body="$message" \
-f head="$branch" \
-f base="$GITHUB_REF_NAME"
fi

View file

@ -0,0 +1,16 @@
name: "Validate devcontainer-feature.json files"
on:
workflow_dispatch:
pull_request:
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: "Validate devcontainer-feature.json files"
uses: devcontainers/action@v1
with:
validate-only: "true"
base-path-to-features: "./src"

60
CONTRIBUTING.md Normal file
View file

@ -0,0 +1,60 @@
**Thanks for taking the time to contribute! ❤️**
All types of contributions are encouraged and valued, no matter if it's a bug
report 🐛, a feature request 💡, or a Pull Request 🚀.
- **❓ I have a question:** Ask in [our dev container community Slack channel]
- **🐛 I found a bug:** [Open an Issue]
- **💡 I have an idea:** [Open an Issue]
- **💻 I want to code:** See below
If you like the project, but just don't have time to contribute, that's OK too!
You can also star the project ⭐, rave about it online 💬, or add a link to us
🔗 in your project's readme.
⚠️ You must never report security 🔒 related issues, vulnerabilities or bugs
including sensitive information to the issue tracker, or elsewhere in public.
Instead, please [report them to the Microsoft Security Response Center]. You can
read more about our security policy in [`SECURITY.md`].
## Contributing code
👨‍💼 This repository is a collection of dev container Features managed by dev
container spec maintainers. This repository will **only accept improvements and
bug fixes** for the [current set of maintained Features].
🚀 If you're looking to create a new Feature, then we encourage adding it to a
separate repository of your control. The [devcontainers/feature-starter]
repository has more guidance on self authoring Features.
💡 Once you've self authored the Features and if you'd like to share them with
the community, then we'd recommend [adding it to the index].
👷‍ If you've identified an issue and you want to fix it, here's how you can get
started:
1. 🔀 Fork the repo
2. 💻 Open the repo in your editor
3. 👨‍💻 Add your changes to your workspace
4. ✨ [Test your changes using `devcontainer features test`] to make sure
everything still works
5. 🆚 Bump the version of the feature you changed according to [semver]
6. 🔖 Commit & push your changes
7. 🔁 Open a PR to get your changes merged
8. 🚀 Profit!
👩‍⚖️ When contributing code to this project, you may be asked to agree to our
[Contributor License Agreement].
<!-- prettier-ignore-start -->
[our dev container community Slack channel]: https://aka.ms/devcontainer_community
[open an issue]: https://github.com/devcontainers/features/issues/new
[current set of maintained Features]: https://github.com/devcontainers/features/tree/main/src
[devcontainers/feature-starter]: https://github.com/devcontainers/feature-starter#readme
[adding it to the index]: https://github.com/devcontainers/feature-starter#adding-features-to-the-index
[report them to the Microsoft Security Response Center]: https://msrc.microsoft.com/create-report
[`SECURITY.md`]: https://github.com/devcontainers/spec/blob/main/SECURITY.md
[contributor license agreement]: https://opensource.microsoft.com/cla/
[Test your changes using `devcontainer features test`]: https://github.com/devcontainers/cli/blob/main/docs/features/test.md
[semver]: https://semver.org/
<!-- prettier-ignore-end -->

View file

@ -9,7 +9,7 @@
</tr></table>
'Features' are self-contained units of installation code and development container configuration. Features are designed
to install atop a wide-range of base container images (**this repo focuses on `debian` based images**).
to install atop a wide-range of base container images.
Missing a CLI or language in your otherwise _perfect_ container image? Add the relevant Feature to the `features`
property of a [`devcontainer.json`](https://containers.dev/implementors/json_reference/#general-properties). A
@ -109,3 +109,7 @@ We are eager to hear your feedback on self-authoring! Please provide comments a
This repository will accept improvement and bug fix contributions related to the
[current set of maintained Features](./src).
🤝 You can read more about how to contribute in [`CONTRIBUTING.md`]. ❤️
[`CONTRIBUTING.md`]: CONTRIBUTING.md

View file

@ -11,3 +11,10 @@ As covered in the [user FAQ](https://docs.anaconda.com/anaconda/user-guide/faq)
```bash
conda install python=3.7
```
## OS Support
This Feature should work on recent versions of Debian/Ubuntu-based distributions with the `apt` package manager installed.
`bash` is required to execute the `install.sh` script.

View file

@ -32,6 +32,13 @@ conda install python=3.7
```
## OS Support
This Feature should work on recent versions of Debian/Ubuntu-based distributions with the `apt` package manager installed.
`bash` is required to execute the `install.sh` script.
---
_Note: This file was auto-generated from the [devcontainer-feature.json](https://github.com/devcontainers/features/blob/main/src/anaconda/devcontainer-feature.json). Add additional notes to a `NOTES.md`._

View file

@ -1,6 +1,6 @@
{
"id": "anaconda",
"version": "1.0.9",
"version": "1.0.11",
"name": "Anaconda",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/anaconda",
"options": {

View file

@ -8,10 +8,10 @@
# Maintainer: The VS Code and Codespaces Teams
VERSION=${VERSION:-"latest"}
USERNAME=${USERNAME:-"automatic"}
UPDATE_RC=${UPDATE_RC:-"true"}
CONDA_DIR=${CONDA_DIR:-"/usr/local/conda"}
VERSION="${VERSION:-"latest"}"
USERNAME="${USERNAME:-"${_REMOTE_USER:-"automatic"}"}"
UPDATE_RC="${UPDATE_RC:-"true"}"
CONDA_DIR="${CONDA_DIR:-"/usr/local/conda"}"
set -eux
export DEBIAN_FRONTEND=noninteractive

View file

@ -1 +1,7 @@
Available versions of the AWS CLI can be found here: https://github.com/aws/aws-cli/blob/v2/CHANGELOG.rst.
## OS Support
This Feature should work on recent versions of Debian/Ubuntu-based distributions with the `apt` package manager installed.
`bash` is required to execute the `install.sh` script.

View file

@ -17,8 +17,21 @@ Installs the AWS CLI along with needed dependencies. Useful for base Dockerfiles
|-----|-----|-----|-----|
| version | Select or enter an AWS CLI version. | string | latest |
## Customizations
### VS Code Extensions
- `AmazonWebServices.aws-toolkit-vscode`
Available versions of the AWS CLI can be found here: https://github.com/aws/aws-cli/blob/v2/CHANGELOG.rst.
## OS Support
This Feature should work on recent versions of Debian/Ubuntu-based distributions with the `apt` package manager installed.
`bash` is required to execute the `install.sh` script.
---
_Note: This file was auto-generated from the [devcontainer-feature.json](https://github.com/devcontainers/features/blob/main/src/aws-cli/devcontainer-feature.json). Add additional notes to a `NOTES.md`._

View file

@ -1,6 +1,6 @@
{
"id": "aws-cli",
"version": "1.0.5",
"version": "1.0.7",
"name": "AWS CLI",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/aws-cli",
"description": "Installs the AWS CLI along with needed dependencies. Useful for base Dockerfiles that often are missing required install dependencies like gpg.",

View file

@ -50,21 +50,6 @@ if [ "$(id -u)" -ne 0 ]; then
exit 1
fi
# Get central common setting
get_common_setting() {
if [ "${common_settings_file_loaded}" != "true" ]; then
curl -sfL "https://aka.ms/vscode-dev-containers/script-library/settings.env" 2>/dev/null -o /tmp/vsdc-settings.env || echo "Could not download settings file. Skipping."
common_settings_file_loaded=true
fi
if [ -f "/tmp/vsdc-settings.env" ]; then
local multi_line=""
if [ "$2" = "true" ]; then multi_line="-z"; fi
local result="$(grep ${multi_line} -oP "$1=\"?\K[^\"]+" /tmp/vsdc-settings.env | tr -d '\0')"
if [ ! -z "${result}" ]; then declare -g $1="${result}"; fi
fi
echo "$1=${!1}"
}
apt_get_update()
{
echo "Running apt-get update..."
@ -89,9 +74,6 @@ check_packages curl ca-certificates gnupg2 dirmngr unzip
verify_aws_cli_gpg_signature() {
local filePath=$1
local sigFilePath=$2
get_common_setting AWSCLI_GPG_KEY
get_common_setting AWSCLI_GPG_KEY_MATERIAL true
local awsGpgKeyring=aws-cli-public-key.gpg
echo "${AWSCLI_GPG_KEY_MATERIAL}" | gpg --dearmor > "./${awsGpgKeyring}"

7
src/azure-cli/NOTES.md Normal file
View file

@ -0,0 +1,7 @@
## OS Support
This Feature should work on recent versions of Debian/Ubuntu-based distributions with the `apt` package manager installed.
`bash` is required to execute the `install.sh` script.

View file

@ -17,7 +17,22 @@ Installs the Azure CLI along with needed dependencies. Useful for base Dockerfil
|-----|-----|-----|-----|
| version | Select or enter an Azure CLI version. (Available versions may vary by Linux distribution.) | string | latest |
| extensions | Optional comma separated list of Azure CLI extensions to install in profile. | string | - |
| installBicep | Optionally install Azure Bicep | boolean | false |
| installUsingPython | Install Azure CLI using Python instead of pipx | boolean | false |
## Customizations
### VS Code Extensions
- `ms-vscode.azurecli`
## OS Support
This Feature should work on recent versions of Debian/Ubuntu-based distributions with the `apt` package manager installed.
`bash` is required to execute the `install.sh` script.
---

View file

@ -1,6 +1,6 @@
{
"id": "azure-cli",
"version": "1.0.6",
"version": "1.2.2",
"name": "Azure CLI",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/azure-cli",
"description": "Installs the Azure CLI along with needed dependencies. Useful for base Dockerfiles that often are missing required install dependencies like gpg.",
@ -17,6 +17,16 @@
"type": "string",
"default": "",
"description": "Optional comma separated list of Azure CLI extensions to install in profile."
},
"installBicep": {
"type": "boolean",
"description": "Optionally install Azure Bicep",
"default": false
},
"installUsingPython": {
"type": "boolean",
"description": "Install Azure CLI using Python instead of pipx",
"default": false
}
},
"customizations": {

View file

@ -14,7 +14,8 @@ rm -rf /var/lib/apt/lists/*
AZ_VERSION=${VERSION:-"latest"}
AZ_EXTENSIONS=${EXTENSIONS}
AZ_INSTALLBICEP=${INSTALLBICEP:-false}
INSTALL_USING_PYTHON=${INSTALL_USING_PYTHON:-true}
MICROSOFT_GPG_KEYS_URI="https://packages.microsoft.com/keys/microsoft.asc"
AZCLI_ARCHIVE_ARCHITECTURES="amd64"
AZCLI_ARCHIVE_VERSION_CODENAMES="stretch buster bullseye bionic focal jammy"
@ -24,20 +25,12 @@ if [ "$(id -u)" -ne 0 ]; then
exit 1
fi
# Get central common setting
get_common_setting() {
if [ "${common_settings_file_loaded}" != "true" ]; then
curl -sfL "https://aka.ms/vscode-dev-containers/script-library/settings.env" 2>/dev/null -o /tmp/vsdc-settings.env || echo "Could not download settings file. Skipping."
common_settings_file_loaded=true
fi
if [ -f "/tmp/vsdc-settings.env" ]; then
local multi_line=""
if [ "$2" = "true" ]; then multi_line="-z"; fi
local result="$(grep ${multi_line} -oP "$1=\"?\K[^\"]+" /tmp/vsdc-settings.env | tr -d '\0')"
if [ ! -z "${result}" ]; then declare -g $1="${result}"; fi
fi
echo "$1=${!1}"
}
if [ -z "${_REMOTE_USER}" ]; then
echo -e 'Feature script must be executed by a tool that implements the dev container specification. See https://containers.dev/ for more information.'
exit 1
fi
echo "Effective REMOTE_USER: ${_REMOTE_USER}"
apt_get_update()
{
@ -56,8 +49,6 @@ check_packages() {
fi
}
export DEBIAN_FRONTEND=noninteractive
# Soft version matching that resolves a version for a given package in the *current apt-cache*
# Return value is stored in first argument (the unprocessed version)
apt_cache_version_soft_match() {
@ -104,7 +95,6 @@ install_using_apt() {
# Install dependencies
check_packages apt-transport-https curl ca-certificates gnupg2 dirmngr
# Import key safely (new 'signed-by' method rather than deprecated apt-key approach) and install
get_common_setting MICROSOFT_GPG_KEYS_URI
curl -sSL ${MICROSOFT_GPG_KEYS_URI} | gpg --dearmor > /usr/share/keyrings/microsoft-archive-keyring.gpg
echo "deb [arch=${architecture} signed-by=/usr/share/keyrings/microsoft-archive-keyring.gpg] https://packages.microsoft.com/repos/azure-cli/ ${VERSION_CODENAME} main" > /etc/apt/sources.list.d/azure-cli.list
apt-get update
@ -126,7 +116,43 @@ install_using_apt() {
fi
}
install_using_pip() {
install_using_pip_strategy() {
local ver=""
if [ "${AZ_VERSION}" = "latest" ] || [ "${AZ_VERSION}" = "lts" ] || [ "${AZ_VERSION}" = "stable" ]; then
# Empty, meaning grab the "latest" in the apt repo
ver=""
else
ver="==${AZ_VERSION}"
fi
if [ "${INSTALL_USING_PYTHON}" = "true" ]; then
install_with_complete_python_installation "${ver}" || install_with_pipx "${ver}" || return 1
else
install_with_pipx "${ver}" || install_with_complete_python_installation "${ver}" || return 1
fi
}
install_with_pipx() {
echo "(*) Attempting to install globally with pipx..."
local ver="$1"
export
local
if ! type pipx > /dev/null 2>&1; then
echo "(*) Installing pipx..."
check_packages pipx
pipx ensurepath # Ensures PIPX_BIN_DIR is on the PATH
fi
PIPX_HOME="/usr/local/pipx" \
PIPX_BIN_DIR=/usr/local/bin \
pipx install azure-cli${ver}
echo "(*) Finished installing globally with pipx."
}
install_with_complete_python_installation() {
local ver="$1"
echo "(*) No pre-built binaries available in apt-cache. Installing via pip3."
if ! dpkg -s python3-minimal python3-pip libffi-dev python3-venv > /dev/null 2>&1; then
apt_get_update
@ -143,25 +169,20 @@ install_using_pip() {
pipx_bin=/tmp/pip-tmp/bin/pipx
fi
if [ "${AZ_VERSION}" = "latest" ] || [ "${AZ_VERSION}" = "lts" ] || [ "${AZ_VERSION}" = "stable" ]; then
# Empty, meaning grab the "latest" in the apt repo
ver=""
else
ver="==${AZ_VERSION}"
fi
set +e
${pipx_bin} install --pip-args '--no-cache-dir --force-reinstall' -f azure-cli${ver}
# Fail gracefully
if [ "$?" != 0 ]; then
echo "Could not install azure-cli${ver} via pip"
echo "Could not install azure-cli${ver} via pip3"
rm -rf /tmp/pip-tmp
return 1
fi
set -e
}
export DEBIAN_FRONTEND=noninteractive
# See if we're on x86_64 and if so, install via apt-get, otherwise use pip3
echo "(*) Installing Azure CLI..."
. /etc/os-release
@ -175,7 +196,7 @@ fi
if [ "${use_pip}" = "true" ]; then
AZ_VERSION=${CACHED_AZURE_VERSION}
install_using_pip
install_using_pip_strategy
if [ "$?" != 0 ]; then
echo "Please provide a valid version for your distribution ${ID} ${VERSION_CODENAME} (${architecture})."
@ -197,6 +218,30 @@ if [ ${#AZ_EXTENSIONS[@]} -gt 0 ]; then
done
fi
if [ "${AZ_INSTALLBICEP}" = "true" ]; then
# Install dependencies
check_packages apt-transport-https curl
# Properly install Azure Bicep based on current architecture
# The `az bicep install` command installs the linux-x64 binary even on arm64 devcontainers
# The `az bicep install --target-platform` could be a solution; however, linux-arm64 is not an allowed value for this argument yet
# Manually installing Bicep and moving to the appropriate directory where az expects it to be
if [ "${architecture}" = "arm64" ]; then
curl -Lo bicep https://github.com/Azure/bicep/releases/latest/download/bicep-linux-arm64
else
curl -Lo bicep https://github.com/Azure/bicep/releases/latest/download/bicep-linux-x64
fi
chmod +x ./bicep
mv ./bicep /usr/local/bin/bicep
# Add a symlink so bicep can be accessed as a standalone executable or as part of az
mkdir -p ${_REMOTE_USER_HOME}/.azure/bin
chown -hR ${_REMOTE_USER}:${_REMOTE_USER} ${_REMOTE_USER_HOME}/.azure
ln -s /usr/local/bin/bicep ${_REMOTE_USER_HOME}/.azure/bin/bicep
fi
# Clean up
rm -rf /var/lib/apt/lists/*

View file

@ -1,12 +1,26 @@
## Speeding up the command prompt in large repositories
## OS Support
This script provides a custom command prompt that includes information about the git repository for the current folder. However, with certain large repositories, this can result in a slow command prompt since the required git status command can be slow. To resolve this, you can update a git setting to remove the git portion of the command prompt.
This Feature should work on recent versions of Debian/Ubuntu, RedHat Enterprise Linux, Fedora, RockyLinux, and Alpine Linux.
To disable the prompt for the current folder's repository, enter the following in a terminal or add it to your `postCreateCommand` or dotfiles:
## Using with dev container images
This Feature is used in many of the [dev container images](https://github.com/search?q=repo%3Adevcontainers%2Fimages+%22ghcr.io%2Fdevcontainers%2Ffeatures%2Fcommon-utils%22&type=code), as a result
these images have already allocated UID & GID 1000. Attempting to add this Feature with UID 1000 and/or GID 1000 on top of such a dev container image will result in an error when building the dev container.
## Customizing the command prompt
By default, this script provides a custom command prompt that includes information about the git repository for the current folder. However, with certain large repositories, this can result in a slow command prompt due to the performance of needed git operations.
For performance reasons, a "dirty" indicator that tells you whether or not there are uncommitted changes is disabled by default. You can opt to turn this on for smaller repositories by entering the following in a terminal or adding it to your `postCreateCommand`:
```bash
git config codespaces-theme.hide-status 1
git config devcontainers-theme.show-dirty 1
```
This setting will survive a rebuild since it is applied to the repository rather than the container.
To completely disable the git portion of the prompt for the current folder's repository, you can use this configuration setting instead:
```bash
git config devcontainers-theme.hide-status 1
```
For `zsh`, the default theme is a [standard Oh My Zsh! theme](https://ohmyz.sh/). You may pick a different one by modifying the `ZSH_THEME` variable in `~/.zshrc`.

View file

@ -1,5 +1,5 @@
# Common Debian Utilities (common-utils)
# Common Utilities (common-utils)
Installs a set of common command line utilities, Oh My Zsh!, and sets up a non-root user.
@ -7,7 +7,7 @@ Installs a set of common command line utilities, Oh My Zsh!, and sets up a non-r
```json
"features": {
"ghcr.io/devcontainers/features/common-utils:1": {}
"ghcr.io/devcontainers/features/common-utils:2": {}
}
```
@ -16,25 +16,41 @@ Installs a set of common command line utilities, Oh My Zsh!, and sets up a non-r
| Options Id | Description | Type | Default Value |
|-----|-----|-----|-----|
| installZsh | Install ZSH? | boolean | true |
| configureZshAsDefaultShell | Change default shell to ZSH? | boolean | false |
| installOhMyZsh | Install Oh My Zsh!? | boolean | true |
| installOhMyZshConfig | Allow installing the default dev container .zshrc templates? | boolean | true |
| upgradePackages | Upgrade OS packages? | boolean | true |
| username | Enter name of non-root user to configure or none to skip | string | automatic |
| uid | Enter uid for non-root user | string | automatic |
| gid | Enter gid for non-root user | string | automatic |
| nonFreePackages | Add packages from non-free Debian repository? | boolean | false |
| username | Enter name of a non-root user to configure or none to skip | string | automatic |
| userUid | Enter UID for non-root user | string | automatic |
| userGid | Enter GID for non-root user | string | automatic |
| nonFreePackages | Add packages from non-free Debian repository? (Debian only) | boolean | false |
## Speeding up the command prompt in large repositories
## OS Support
This script provides a custom command prompt that includes information about the git repository for the current folder. However, with certain large repositories, this can result in a slow command prompt since the required git status command can be slow. To resolve this, you can update a git setting to remove the git portion of the command prompt.
This Feature should work on recent versions of Debian/Ubuntu, RedHat Enterprise Linux, Fedora, RockyLinux, and Alpine Linux.
To disable the prompt for the current folder's repository, enter the following in a terminal or add it to your `postCreateCommand` or dotfiles:
## Using with dev container images
This Feature is used in many of the [dev container images](https://github.com/search?q=repo%3Adevcontainers%2Fimages+%22ghcr.io%2Fdevcontainers%2Ffeatures%2Fcommon-utils%22&type=code), as a result
these images have already allocated UID & GID 1000. Attempting to add this Feature with UID 1000 and/or GID 1000 on top of such a dev container image will result in an error when building the dev container.
## Customizing the command prompt
By default, this script provides a custom command prompt that includes information about the git repository for the current folder. However, with certain large repositories, this can result in a slow command prompt due to the performance of needed git operations.
For performance reasons, a "dirty" indicator that tells you whether or not there are uncommitted changes is disabled by default. You can opt to turn this on for smaller repositories by entering the following in a terminal or adding it to your `postCreateCommand`:
```bash
git config codespaces-theme.hide-status 1
git config devcontainers-theme.show-dirty 1
```
This setting will survive a rebuild since it is applied to the repository rather than the container.
To completely disable the git portion of the prompt for the current folder's repository, you can use this configuration setting instead:
```bash
git config devcontainers-theme.hide-status 1
```
For `zsh`, the default theme is a [standard Oh My Zsh! theme](https://ohmyz.sh/). You may pick a different one by modifying the `ZSH_THEME` variable in `~/.zshrc`.
---

16
src/common-utils/bin/code Executable file
View file

@ -0,0 +1,16 @@
#!/bin/sh
get_in_path_except_current() {
which -a "$1" | grep -A1 "$0" | grep -v "$0"
}
code="$(get_in_path_except_current code)"
if [ -n "$code" ]; then
exec "$code" "$@"
elif [ "$(command -v code-insiders)" ]; then
exec code-insiders "$@"
else
echo "code or code-insiders is not installed" >&2
exit 127
fi

View file

@ -0,0 +1,35 @@
#!/bin/sh
# Load meta.env
if [ -f "/usr/local/etc/vscode-dev-containers/meta.env" ]; then
. /usr/local/etc/vscode-dev-containers/meta.env
fi
if [ -f "/usr/local/etc/dev-containers/meta.env" ]; then
. /usr/local/etc/dev-containers/meta.env
fi
# Minimal output
if [ "$1" = "version" ] || [ "$1" = "image-version" ]; then
echo "${VERSION}"
exit 0
elif [ "$1" = "release" ]; then
echo "${GIT_REPOSITORY_RELEASE}"
exit 0
elif [ "$1" = "content" ] || [ "$1" = "content-url" ] || [ "$1" = "contents" ] || [ "$1" = "contents-url" ]; then
echo "${CONTENTS_URL}"
exit 0
fi
#Full output
echo
echo "Development container image information"
echo
if [ ! -z "${VERSION}" ]; then echo "- Image version: ${VERSION}"; fi
if [ ! -z "${DEFINITION_ID}" ]; then echo "- Definition ID: ${DEFINITION_ID}"; fi
if [ ! -z "${VARIANT}" ]; then echo "- Variant: ${VARIANT}"; fi
if [ ! -z "${GIT_REPOSITORY}" ]; then echo "- Source code repository: ${GIT_REPOSITORY}"; fi
if [ ! -z "${GIT_REPOSITORY_RELEASE}" ]; then echo "- Source code release/branch: ${GIT_REPOSITORY_RELEASE}"; fi
if [ ! -z "${GIT_REPOSITORY_REVISION}" ]; then echo "- Source code revision: ${GIT_REPOSITORY_REVISION}"; fi
if [ ! -z "${BUILD_TIMESTAMP}" ]; then echo "- Timestamp: ${BUILD_TIMESTAMP}"; fi
if [ ! -z "${CONTENTS_URL}" ]; then echo && echo "More info: ${CONTENTS_URL}"; fi
echo

7
src/common-utils/bin/systemctl Executable file
View file

@ -0,0 +1,7 @@
#!/bin/sh
set -e
if [ -d "/run/systemd/system" ]; then
exec /bin/systemctl "$@"
else
echo '\n"systemd" is not running in this container due to its overhead.\nUse the "service" command to start services instead. e.g.: \n\nservice --status-all'
fi

View file

@ -1,7 +1,7 @@
{
"id": "common-utils",
"version": "1.1.4",
"name": "Common Debian Utilities",
"version": "2.3.1",
"name": "Common Utilities",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/common-utils",
"description": "Installs a set of common command line utilities, Oh My Zsh!, and sets up a non-root user.",
"options": {
@ -10,11 +10,21 @@
"default": true,
"description": "Install ZSH?"
},
"configureZshAsDefaultShell": {
"type": "boolean",
"default": false,
"description": "Change default shell to ZSH?"
},
"installOhMyZsh": {
"type": "boolean",
"default": true,
"description": "Install Oh My Zsh!?"
},
"installOhMyZshConfig": {
"type": "boolean",
"default": true,
"description": "Allow installing the default dev container .zshrc templates?"
},
"upgradePackages": {
"type": "boolean",
"default": true,
@ -23,36 +33,37 @@
"username": {
"type": "string",
"proposals": [
"devcontainer",
"vscode",
"codespace",
"none",
"automatic"
],
"default": "automatic",
"description": "Enter name of non-root user to configure or none to skip"
"description": "Enter name of a non-root user to configure or none to skip"
},
"uid": {
"userUid": {
"type": "string",
"proposals": [
"1000",
"1001",
"automatic"
],
"default": "automatic",
"description": "Enter uid for non-root user"
"description": "Enter UID for non-root user"
},
"gid": {
"userGid": {
"type": "string",
"proposals": [
"1000",
"1001",
"automatic"
],
"default": "automatic",
"description": "Enter gid for non-root user"
"description": "Enter GID for non-root user"
},
"nonFreePackages": {
"type": "boolean",
"default": false,
"description": "Add packages from non-free Debian repository?"
"description": "Add packages from non-free Debian repository? (Debian only)"
}
}
}

View file

@ -1,24 +1,23 @@
#!/usr/bin/env bash
#-------------------------------------------------------------------------------------------------------------
#!/bin/sh
#-------------------------------------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
#-------------------------------------------------------------------------------------------------------------
# Licensed under the MIT License. See https://github.com/devcontainers/features/blob/main/LICENSE for license information.
#-------------------------------------------------------------------------------------------------------------------------
#
# Docs: https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/docs/common.md
# Maintainer: The VS Code and Codespaces Teams
# Docs: https://github.com/devcontainers/features/tree/main/src/common-utils
# Maintainer: The Dev Container spec maintainers
set -e
# Clean up
rm -rf /var/lib/apt/lists/*
INSTALL_ZSH=${INSTALLZSH:-"true"}
INSTALL_OH_MY_ZSH=${INSTALLOHMYZSH:-"true"}
UPGRADE_PACKAGES=${UPGRADEPACKAGES:-"true"}
USERNAME=${USERNAME:-"automatic"}
USER_UID=${UID:-"automatic"}
USER_GID=${GID:-"automatic"}
ADD_NON_FREE_PACKAGES=${NONFREEPACKAGES:-"false"}
INSTALL_ZSH="${INSTALLZSH:-"true"}"
CONFIGURE_ZSH_AS_DEFAULT_SHELL="${CONFIGUREZSHASDEFAULTSHELL:-"false"}"
INSTALL_OH_MY_ZSH="${INSTALLOHMYZSH:-"true"}"
INSTALL_OH_MY_ZSH_CONFIG="${INSTALLOHMYZSHCONFIG:-"true"}"
UPGRADE_PACKAGES="${UPGRADEPACKAGES:-"true"}"
USERNAME="${USERNAME:-"automatic"}"
USER_UID="${UID:-"automatic"}"
USER_GID="${GID:-"automatic"}"
ADD_NON_FREE_PACKAGES="${NONFREEPACKAGES:-"false"}"
MARKER_FILE="/usr/local/etc/vscode-dev-containers/common"
@ -27,437 +26,11 @@ if [ "$(id -u)" -ne 0 ]; then
exit 1
fi
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
rm -f /etc/profile.d/00-restore-env.sh
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
chmod +x /etc/profile.d/00-restore-env.sh
# If in automatic mode, determine if a user already exists, if not use vscode
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=vscode
fi
elif [ "${USERNAME}" = "none" ]; then
USERNAME=root
USER_UID=0
USER_GID=0
# If we're using Alpine, install bash before executing
. /etc/os-release
if [ "${ID}" = "alpine" ]; then
apk add --no-cache bash
fi
# Load markers to see which steps have already run
if [ -f "${MARKER_FILE}" ]; then
echo "Marker file found:"
cat "${MARKER_FILE}"
source "${MARKER_FILE}"
fi
# Ensure apt is in non-interactive to avoid prompts
export DEBIAN_FRONTEND=noninteractive
apt_get_update()
{
if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then
echo "Running apt-get update..."
apt-get update -y
fi
}
# Run install apt-utils to avoid debconf warning then verify presence of other common developer tools and dependencies
if [ "${PACKAGES_ALREADY_INSTALLED}" != "true" ]; then
package_list="apt-utils \
openssh-client \
gnupg2 \
dirmngr \
iproute2 \
procps \
lsof \
htop \
net-tools \
psmisc \
curl \
tree \
wget \
rsync \
ca-certificates \
unzip \
bzip2 \
zip \
nano \
vim-tiny \
less \
jq \
lsb-release \
apt-transport-https \
dialog \
libc6 \
libgcc1 \
libkrb5-3 \
libgssapi-krb5-2 \
libicu[0-9][0-9] \
liblttng-ust[0-9] \
libstdc++6 \
zlib1g \
locales \
sudo \
ncdu \
man-db \
strace \
manpages \
manpages-dev \
init-system-helpers"
# Needed for adding manpages-posix and manpages-posix-dev which are non-free packages in Debian
if [ "${ADD_NON_FREE_PACKAGES}" = "true" ]; then
# Bring in variables from /etc/os-release like VERSION_CODENAME
. /etc/os-release
sed -i -E "s/deb http:\/\/(deb|httpredir)\.debian\.org\/debian ${VERSION_CODENAME} main/deb http:\/\/\1\.debian\.org\/debian ${VERSION_CODENAME} main contrib non-free/" /etc/apt/sources.list
sed -i -E "s/deb-src http:\/\/(deb|httredir)\.debian\.org\/debian ${VERSION_CODENAME} main/deb http:\/\/\1\.debian\.org\/debian ${VERSION_CODENAME} main contrib non-free/" /etc/apt/sources.list
sed -i -E "s/deb http:\/\/(deb|httpredir)\.debian\.org\/debian ${VERSION_CODENAME}-updates main/deb http:\/\/\1\.debian\.org\/debian ${VERSION_CODENAME}-updates main contrib non-free/" /etc/apt/sources.list
sed -i -E "s/deb-src http:\/\/(deb|httpredir)\.debian\.org\/debian ${VERSION_CODENAME}-updates main/deb http:\/\/\1\.debian\.org\/debian ${VERSION_CODENAME}-updates main contrib non-free/" /etc/apt/sources.list
sed -i "s/deb http:\/\/security\.debian\.org\/debian-security ${VERSION_CODENAME}\/updates main/deb http:\/\/security\.debian\.org\/debian-security ${VERSION_CODENAME}\/updates main contrib non-free/" /etc/apt/sources.list
sed -i "s/deb-src http:\/\/security\.debian\.org\/debian-security ${VERSION_CODENAME}\/updates main/deb http:\/\/security\.debian\.org\/debian-security ${VERSION_CODENAME}\/updates main contrib non-free/" /etc/apt/sources.list
sed -i "s/deb http:\/\/deb\.debian\.org\/debian ${VERSION_CODENAME}-backports main/deb http:\/\/deb\.debian\.org\/debian ${VERSION_CODENAME}-backports main contrib non-free/" /etc/apt/sources.list
sed -i "s/deb-src http:\/\/deb\.debian\.org\/debian ${VERSION_CODENAME}-backports main/deb http:\/\/deb\.debian\.org\/debian ${VERSION_CODENAME}-backports main contrib non-free/" /etc/apt/sources.list
# Handle bullseye location for security https://www.debian.org/releases/bullseye/amd64/release-notes/ch-information.en.html
sed -i "s/deb http:\/\/security\.debian\.org\/debian-security ${VERSION_CODENAME}-security main/deb http:\/\/security\.debian\.org\/debian-security ${VERSION_CODENAME}-security main contrib non-free/" /etc/apt/sources.list
sed -i "s/deb-src http:\/\/security\.debian\.org\/debian-security ${VERSION_CODENAME}-security main/deb http:\/\/security\.debian\.org\/debian-security ${VERSION_CODENAME}-security main contrib non-free/" /etc/apt/sources.list
echo "Running apt-get update..."
apt-get update
package_list="${package_list} manpages-posix manpages-posix-dev"
else
apt_get_update
fi
# Install libssl1.1 if available
if [[ ! -z $(apt-cache --names-only search ^libssl1.1$) ]]; then
package_list="${package_list} libssl1.1"
fi
# Install libssl3 if available
if [[ ! -z $(apt-cache --names-only search ^libssl3$) ]]; then
package_list="${package_list} libssl3"
fi
# Install appropriate version of libssl1.0.x if available
libssl_package=$(dpkg-query -f '${db:Status-Abbrev}\t${binary:Package}\n' -W 'libssl1\.0\.?' 2>&1 || echo '')
if [ "$(echo "$LIlibssl_packageBSSL" | grep -o 'libssl1\.0\.[0-9]:' | uniq | sort | wc -l)" -eq 0 ]; then
if [[ ! -z $(apt-cache --names-only search ^libssl1.0.2$) ]]; then
# Debian 9
package_list="${package_list} libssl1.0.2"
elif [[ ! -z $(apt-cache --names-only search ^libssl1.0.0$) ]]; then
# Ubuntu 18.04, 16.04, earlier
package_list="${package_list} libssl1.0.0"
fi
fi
echo "Packages to verify are installed: ${package_list}"
apt-get -y install --no-install-recommends ${package_list} 2> >( grep -v 'debconf: delaying package configuration, since apt-utils is not installed' >&2 )
# Install git if not already installed (may be more recent than distro version)
if ! type git > /dev/null 2>&1; then
apt-get -y install --no-install-recommends git
fi
PACKAGES_ALREADY_INSTALLED="true"
fi
# Get to latest versions of all packages
if [ "${UPGRADE_PACKAGES}" = "true" ]; then
apt_get_update
apt-get -y upgrade --no-install-recommends
apt-get autoremove -y
fi
# Ensure at least the en_US.UTF-8 UTF-8 locale is available.
# Common need for both applications and things like the agnoster ZSH theme.
if [ "${LOCALE_ALREADY_SET}" != "true" ] && ! grep -o -E '^\s*en_US.UTF-8\s+UTF-8' /etc/locale.gen > /dev/null; then
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
locale-gen
LOCALE_ALREADY_SET="true"
fi
# Create or update a non-root user to match UID/GID.
group_name="${USERNAME}"
if id -u ${USERNAME} > /dev/null 2>&1; then
# User exists, update if needed
if [ "${USER_GID}" != "automatic" ] && [ "$USER_GID" != "$(id -g $USERNAME)" ]; then
group_name="$(id -gn $USERNAME)"
groupmod --gid $USER_GID ${group_name}
usermod --gid $USER_GID $USERNAME
fi
if [ "${USER_UID}" != "automatic" ] && [ "$USER_UID" != "$(id -u $USERNAME)" ]; then
usermod --uid $USER_UID $USERNAME
fi
else
# Create user
if [ "${USER_GID}" = "automatic" ]; then
groupadd $USERNAME
else
groupadd --gid $USER_GID $USERNAME
fi
if [ "${USER_UID}" = "automatic" ]; then
useradd -s /bin/bash --gid $USERNAME -m $USERNAME
else
useradd -s /bin/bash --uid $USER_UID --gid $USERNAME -m $USERNAME
fi
fi
# Add add sudo support for non-root user
if [ "${USERNAME}" != "root" ] && [ "${EXISTING_NON_ROOT_USER}" != "${USERNAME}" ]; then
echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME
chmod 0440 /etc/sudoers.d/$USERNAME
EXISTING_NON_ROOT_USER="${USERNAME}"
fi
# ** Shell customization section **
if [ "${USERNAME}" = "root" ]; then
user_rc_path="/root"
else
user_rc_path="/home/${USERNAME}"
fi
# Restore user .bashrc defaults from skeleton file if it doesn't exist or is empty
if [ ! -f "${user_rc_path}/.bashrc" ] || [ ! -s "${user_rc_path}/.bashrc" ] ; then
cp /etc/skel/.bashrc "${user_rc_path}/.bashrc"
fi
# Restore user .profile defaults from skeleton file if it doesn't exist or is empty
if [ ! -f "${user_rc_path}/.profile" ] || [ ! -s "${user_rc_path}/.profile" ] ; then
cp /etc/skel/.profile "${user_rc_path}/.profile"
fi
# .bashrc/.zshrc snippet
rc_snippet="$(cat << 'EOF'
if [ -z "${USER}" ]; then export USER=$(whoami); fi
if [[ "${PATH}" != *"$HOME/.local/bin"* ]]; then export PATH="${PATH}:$HOME/.local/bin"; fi
# Display optional first run image specific notice if configured and terminal is interactive
if [ -t 1 ] && [[ "${TERM_PROGRAM}" = "vscode" || "${TERM_PROGRAM}" = "codespaces" ]] && [ ! -f "$HOME/.config/vscode-dev-containers/first-run-notice-already-displayed" ]; then
if [ -f "/usr/local/etc/vscode-dev-containers/first-run-notice.txt" ]; then
cat "/usr/local/etc/vscode-dev-containers/first-run-notice.txt"
elif [ -f "/workspaces/.codespaces/shared/first-run-notice.txt" ]; then
cat "/workspaces/.codespaces/shared/first-run-notice.txt"
fi
mkdir -p "$HOME/.config/vscode-dev-containers"
# Mark first run notice as displayed after 10s to avoid problems with fast terminal refreshes hiding it
((sleep 10s; touch "$HOME/.config/vscode-dev-containers/first-run-notice-already-displayed") &)
fi
# Set the default git editor if not already set
if [ -z "$(git config --get core.editor)" ] && [ -z "${GIT_EDITOR}" ]; then
if [ "${TERM_PROGRAM}" = "vscode" ]; then
if [[ -n $(command -v code-insiders) && -z $(command -v code) ]]; then
export GIT_EDITOR="code-insiders --wait"
else
export GIT_EDITOR="code --wait"
fi
fi
fi
EOF
)"
# code shim, it fallbacks to code-insiders if code is not available
cat << 'EOF' > /usr/local/bin/code
#!/bin/sh
get_in_path_except_current() {
which -a "$1" | grep -A1 "$0" | grep -v "$0"
}
code="$(get_in_path_except_current code)"
if [ -n "$code" ]; then
exec "$code" "$@"
elif [ "$(command -v code-insiders)" ]; then
exec code-insiders "$@"
else
echo "code or code-insiders is not installed" >&2
exit 127
fi
EOF
chmod +x /usr/local/bin/code
# systemctl shim - tells people to use 'service' if systemd is not running
cat << 'EOF' > /usr/local/bin/systemctl
#!/bin/sh
set -e
if [ -d "/run/systemd/system" ]; then
exec /bin/systemctl/systemctl "$@"
else
echo '\n"systemd" is not running in this container due to its overhead.\nUse the "service" command to start services instead. e.g.: \n\nservice --status-all'
fi
EOF
chmod +x /usr/local/bin/systemctl
# Codespaces bash and OMZ themes - partly inspired by https://github.com/ohmyzsh/ohmyzsh/blob/master/themes/robbyrussell.zsh-theme
codespaces_bash="$(cat \
<<'EOF'
# Codespaces bash prompt theme
__bash_prompt() {
local userpart='`export XIT=$? \
&& [ ! -z "${GITHUB_USER}" ] && echo -n "\[\033[0;32m\]@${GITHUB_USER} " || echo -n "\[\033[0;32m\]\u " \
&& [ "$XIT" -ne "0" ] && echo -n "\[\033[1;31m\]➜" || echo -n "\[\033[0m\]➜"`'
local gitbranch='`\
if [ "$(git config --get codespaces-theme.hide-status 2>/dev/null)" != 1 ]; then \
export BRANCH=$(git symbolic-ref --short HEAD 2>/dev/null || git rev-parse --short HEAD 2>/dev/null); \
if [ "${BRANCH}" != "" ]; then \
echo -n "\[\033[0;36m\](\[\033[1;31m\]${BRANCH}" \
&& if git ls-files --error-unmatch -m --directory --no-empty-directory -o --exclude-standard ":/*" > /dev/null 2>&1; then \
echo -n " \[\033[1;33m\]✗"; \
fi \
&& echo -n "\[\033[0;36m\]) "; \
fi; \
fi`'
local lightblue='\[\033[1;34m\]'
local removecolor='\[\033[0m\]'
PS1="${userpart} ${lightblue}\w ${gitbranch}${removecolor}\$ "
unset -f __bash_prompt
}
__bash_prompt
EOF
)"
codespaces_zsh="$(cat \
<<'EOF'
# Codespaces zsh prompt theme
__zsh_prompt() {
local prompt_username
if [ ! -z "${GITHUB_USER}" ]; then
prompt_username="@${GITHUB_USER}"
else
prompt_username="%n"
fi
PROMPT="%{$fg[green]%}${prompt_username} %(?:%{$reset_color%}➜ :%{$fg_bold[red]%}➜ )" # User/exit code arrow
PROMPT+='%{$fg_bold[blue]%}%(5~|%-1~/…/%3~|%4~)%{$reset_color%} ' # cwd
PROMPT+='$([ "$(git config --get codespaces-theme.hide-status 2>/dev/null)" != 1 ] && git_prompt_info)' # Git status
PROMPT+='%{$fg[white]%}$ %{$reset_color%}'
unset -f __zsh_prompt
}
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[cyan]%}(%{$fg_bold[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg_bold[yellow]%}✗%{$fg_bold[cyan]%})"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[cyan]%})"
__zsh_prompt
EOF
)"
# Add RC snippet and custom bash prompt
if [ "${RC_SNIPPET_ALREADY_ADDED}" != "true" ]; then
echo "${rc_snippet}" >> /etc/bash.bashrc
echo "${codespaces_bash}" >> "${user_rc_path}/.bashrc"
echo 'export PROMPT_DIRTRIM=4' >> "${user_rc_path}/.bashrc"
if [ "${USERNAME}" != "root" ]; then
echo "${codespaces_bash}" >> "/root/.bashrc"
echo 'export PROMPT_DIRTRIM=4' >> "/root/.bashrc"
fi
chown ${USERNAME}:${group_name} "${user_rc_path}/.bashrc"
RC_SNIPPET_ALREADY_ADDED="true"
fi
# Optionally install and configure zsh and Oh My Zsh!
if [ "${INSTALL_ZSH}" = "true" ]; then
if ! type zsh > /dev/null 2>&1; then
apt_get_update
apt-get install -y zsh
fi
if [ "${ZSH_ALREADY_INSTALLED}" != "true" ]; then
echo "${rc_snippet}" >> /etc/zsh/zshrc
ZSH_ALREADY_INSTALLED="true"
fi
# Adapted, simplified inline Oh My Zsh! install steps that adds, defaults to a codespaces theme.
# See https://github.com/ohmyzsh/ohmyzsh/blob/master/tools/install.sh for official script.
oh_my_install_dir="${user_rc_path}/.oh-my-zsh"
if [ ! -d "${oh_my_install_dir}" ] && [ "${INSTALL_OH_MY_ZSH}" = "true" ]; then
template_path="${oh_my_install_dir}/templates/zshrc.zsh-template"
user_rc_file="${user_rc_path}/.zshrc"
umask g-w,o-w
mkdir -p ${oh_my_install_dir}
git clone --depth=1 \
-c core.eol=lf \
-c core.autocrlf=false \
-c fsck.zeroPaddedFilemode=ignore \
-c fetch.fsck.zeroPaddedFilemode=ignore \
-c receive.fsck.zeroPaddedFilemode=ignore \
"https://github.com/ohmyzsh/ohmyzsh" "${oh_my_install_dir}" 2>&1
echo -e "$(cat "${template_path}")\nDISABLE_AUTO_UPDATE=true\nDISABLE_UPDATE_PROMPT=true" > ${user_rc_file}
sed -i -e 's/ZSH_THEME=.*/ZSH_THEME="codespaces"/g' ${user_rc_file}
mkdir -p ${oh_my_install_dir}/custom/themes
echo "${codespaces_zsh}" > "${oh_my_install_dir}/custom/themes/codespaces.zsh-theme"
# Shrink git while still enabling updates
cd "${oh_my_install_dir}"
git repack -a -d -f --depth=1 --window=1
# Copy to non-root user if one is specified
if [ "${USERNAME}" != "root" ]; then
cp -rf "${user_rc_file}" "${oh_my_install_dir}" /root
chown -R ${USERNAME}:${group_name} "${user_rc_path}"
fi
fi
fi
# Persist image metadata info, script if meta.env found in same directory
meta_info_script="$(cat << 'EOF'
#!/bin/sh
. /usr/local/etc/vscode-dev-containers/meta.env
# Minimal output
if [ "$1" = "version" ] || [ "$1" = "image-version" ]; then
echo "${VERSION}"
exit 0
elif [ "$1" = "release" ]; then
echo "${GIT_REPOSITORY_RELEASE}"
exit 0
elif [ "$1" = "content" ] || [ "$1" = "content-url" ] || [ "$1" = "contents" ] || [ "$1" = "contents-url" ]; then
echo "${CONTENTS_URL}"
exit 0
fi
#Full output
echo
echo "Development container image information"
echo
if [ ! -z "${VERSION}" ]; then echo "- Image version: ${VERSION}"; fi
if [ ! -z "${DEFINITION_ID}" ]; then echo "- Definition ID: ${DEFINITION_ID}"; fi
if [ ! -z "${VARIANT}" ]; then echo "- Variant: ${VARIANT}"; fi
if [ ! -z "${GIT_REPOSITORY}" ]; then echo "- Source code repository: ${GIT_REPOSITORY}"; fi
if [ ! -z "${GIT_REPOSITORY_RELEASE}" ]; then echo "- Source code release/branch: ${GIT_REPOSITORY_RELEASE}"; fi
if [ ! -z "${BUILD_TIMESTAMP}" ]; then echo "- Timestamp: ${BUILD_TIMESTAMP}"; fi
if [ ! -z "${CONTENTS_URL}" ]; then echo && echo "More info: ${CONTENTS_URL}"; fi
echo
EOF
)"
if [ -f "/usr/local/etc/vscode-dev-containers/meta.env" ]; then
echo "${meta_info_script}" > /usr/local/bin/devcontainer-info
chmod +x /usr/local/bin/devcontainer-info
fi
if [ ! -d "/usr/local/etc/vscode-dev-containers" ]; then
mkdir -p "$(dirname "${MARKER_FILE}")"
fi
# Write marker file
echo -e "\
PACKAGES_ALREADY_INSTALLED=${PACKAGES_ALREADY_INSTALLED}\n\
LOCALE_ALREADY_SET=${LOCALE_ALREADY_SET}\n\
EXISTING_NON_ROOT_USER=${EXISTING_NON_ROOT_USER}\n\
RC_SNIPPET_ALREADY_ADDED=${RC_SNIPPET_ALREADY_ADDED}\n\
ZSH_ALREADY_INSTALLED=${ZSH_ALREADY_INSTALLED}" > "${MARKER_FILE}"
# Clean up
rm -rf /var/lib/apt/lists/*
echo "Done!"
exec /bin/bash "$(dirname $0)/main.sh" "$@"
exit $?

573
src/common-utils/main.sh Normal file
View file

@ -0,0 +1,573 @@
#!/bin/bash
#-------------------------------------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See https://github.com/devcontainers/features/blob/main/LICENSE for license information.
#-------------------------------------------------------------------------------------------------------------------------
#
# Docs: https://github.com/devcontainers/features/tree/main/src/common-utils
# Maintainer: The Dev Container spec maintainers
set -e
INSTALL_ZSH="${INSTALLZSH:-"true"}"
CONFIGURE_ZSH_AS_DEFAULT_SHELL="${CONFIGUREZSHASDEFAULTSHELL:-"false"}"
INSTALL_OH_MY_ZSH="${INSTALLOHMYZSH:-"true"}"
INSTALL_OH_MY_ZSH_CONFIG="${INSTALLOHMYZSHCONFIG:-"true"}"
UPGRADE_PACKAGES="${UPGRADEPACKAGES:-"true"}"
USERNAME="${USERNAME:-"automatic"}"
USER_UID="${USERUID:-"automatic"}"
USER_GID="${USERGID:-"automatic"}"
ADD_NON_FREE_PACKAGES="${NONFREEPACKAGES:-"false"}"
MARKER_FILE="/usr/local/etc/vscode-dev-containers/common"
FEATURE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# Debian / Ubuntu packages
install_debian_packages() {
# Ensure apt is in non-interactive to avoid prompts
export DEBIAN_FRONTEND=noninteractive
local package_list=""
if [ "${PACKAGES_ALREADY_INSTALLED}" != "true" ]; then
package_list="${package_list} \
apt-utils \
openssh-client \
gnupg2 \
dirmngr \
iproute2 \
procps \
lsof \
htop \
net-tools \
psmisc \
curl \
tree \
wget \
rsync \
ca-certificates \
unzip \
bzip2 \
zip \
nano \
vim-tiny \
less \
jq \
lsb-release \
apt-transport-https \
dialog \
libc6 \
libgcc1 \
libkrb5-3 \
libgssapi-krb5-2 \
libicu[0-9][0-9] \
liblttng-ust[0-9] \
libstdc++6 \
zlib1g \
locales \
sudo \
ncdu \
man-db \
strace \
manpages \
manpages-dev \
init-system-helpers"
# Include libssl1.1 if available
if [[ ! -z $(apt-cache --names-only search ^libssl1.1$) ]]; then
package_list="${package_list} libssl1.1"
fi
# Include libssl3 if available
if [[ ! -z $(apt-cache --names-only search ^libssl3$) ]]; then
package_list="${package_list} libssl3"
fi
# Include appropriate version of libssl1.0.x if available
local libssl_package=$(dpkg-query -f '${db:Status-Abbrev}\t${binary:Package}\n' -W 'libssl1\.0\.?' 2>&1 || echo '')
if [ "$(echo "$libssl_package" | grep -o 'libssl1\.0\.[0-9]:' | uniq | sort | wc -l)" -eq 0 ]; then
if [[ ! -z $(apt-cache --names-only search ^libssl1.0.2$) ]]; then
# Debian 9
package_list="${package_list} libssl1.0.2"
elif [[ ! -z $(apt-cache --names-only search ^libssl1.0.0$) ]]; then
# Ubuntu 18.04
package_list="${package_list} libssl1.0.0"
fi
fi
# Include git if not already installed (may be more recent than distro version)
if ! type git > /dev/null 2>&1; then
package_list="${package_list} git"
fi
fi
# Needed for adding manpages-posix and manpages-posix-dev which are non-free packages in Debian
if [ "${ADD_NON_FREE_PACKAGES}" = "true" ]; then
# Bring in variables from /etc/os-release like VERSION_CODENAME
sed -i -E "s/deb http:\/\/(deb|httpredir)\.debian\.org\/debian ${VERSION_CODENAME} main/deb http:\/\/\1\.debian\.org\/debian ${VERSION_CODENAME} main contrib non-free/" /etc/apt/sources.list
sed -i -E "s/deb-src http:\/\/(deb|httredir)\.debian\.org\/debian ${VERSION_CODENAME} main/deb http:\/\/\1\.debian\.org\/debian ${VERSION_CODENAME} main contrib non-free/" /etc/apt/sources.list
sed -i -E "s/deb http:\/\/(deb|httpredir)\.debian\.org\/debian ${VERSION_CODENAME}-updates main/deb http:\/\/\1\.debian\.org\/debian ${VERSION_CODENAME}-updates main contrib non-free/" /etc/apt/sources.list
sed -i -E "s/deb-src http:\/\/(deb|httpredir)\.debian\.org\/debian ${VERSION_CODENAME}-updates main/deb http:\/\/\1\.debian\.org\/debian ${VERSION_CODENAME}-updates main contrib non-free/" /etc/apt/sources.list
sed -i "s/deb http:\/\/security\.debian\.org\/debian-security ${VERSION_CODENAME}\/updates main/deb http:\/\/security\.debian\.org\/debian-security ${VERSION_CODENAME}\/updates main contrib non-free/" /etc/apt/sources.list
sed -i "s/deb-src http:\/\/security\.debian\.org\/debian-security ${VERSION_CODENAME}\/updates main/deb http:\/\/security\.debian\.org\/debian-security ${VERSION_CODENAME}\/updates main contrib non-free/" /etc/apt/sources.list
sed -i "s/deb http:\/\/deb\.debian\.org\/debian ${VERSION_CODENAME}-backports main/deb http:\/\/deb\.debian\.org\/debian ${VERSION_CODENAME}-backports main contrib non-free/" /etc/apt/sources.list
sed -i "s/deb-src http:\/\/deb\.debian\.org\/debian ${VERSION_CODENAME}-backports main/deb http:\/\/deb\.debian\.org\/debian ${VERSION_CODENAME}-backports main contrib non-free/" /etc/apt/sources.list
# Handle bullseye location for security https://www.debian.org/releases/bullseye/amd64/release-notes/ch-information.en.html
sed -i "s/deb http:\/\/security\.debian\.org\/debian-security ${VERSION_CODENAME}-security main/deb http:\/\/security\.debian\.org\/debian-security ${VERSION_CODENAME}-security main contrib non-free/" /etc/apt/sources.list
sed -i "s/deb-src http:\/\/security\.debian\.org\/debian-security ${VERSION_CODENAME}-security main/deb http:\/\/security\.debian\.org\/debian-security ${VERSION_CODENAME}-security main contrib non-free/" /etc/apt/sources.list
echo "Running apt-get update..."
package_list="${package_list} manpages-posix manpages-posix-dev"
fi
# Install the list of packages
echo "Packages to verify are installed: ${package_list}"
rm -rf /var/lib/apt/lists/*
apt-get update -y
apt-get -y install --no-install-recommends ${package_list} 2> >( grep -v 'debconf: delaying package configuration, since apt-utils is not installed' >&2 )
# Install zsh (and recommended packages) if needed
if [ "${INSTALL_ZSH}" = "true" ] && ! type zsh > /dev/null 2>&1; then
apt-get install -y zsh
fi
# Get to latest versions of all packages
if [ "${UPGRADE_PACKAGES}" = "true" ]; then
apt-get -y upgrade --no-install-recommends
apt-get autoremove -y
fi
# Ensure at least the en_US.UTF-8 UTF-8 locale is available = common need for both applications and things like the agnoster ZSH theme.
if [ "${LOCALE_ALREADY_SET}" != "true" ] && ! grep -o -E '^\s*en_US.UTF-8\s+UTF-8' /etc/locale.gen > /dev/null; then
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
locale-gen
LOCALE_ALREADY_SET="true"
fi
PACKAGES_ALREADY_INSTALLED="true"
# Clean up
apt-get -y clean
rm -rf /var/lib/apt/lists/*
}
# RedHat / RockyLinux / CentOS / Fedora packages
install_redhat_packages() {
local package_list=""
local remove_epel="false"
local install_cmd=dnf
if ! type dnf > /dev/null 2>&1; then
install_cmd=yum
fi
if [ "${PACKAGES_ALREADY_INSTALLED}" != "true" ]; then
package_list="${package_list} \
gawk \
openssh-clients \
gnupg2 \
iproute \
procps \
lsof \
net-tools \
psmisc \
wget \
ca-certificates \
rsync \
unzip \
zip \
nano \
vim-minimal \
less \
jq \
openssl-libs \
krb5-libs \
libicu \
zlib \
sudo \
sed \
grep \
which \
man-db \
strace"
# rockylinux:9 installs 'curl-minimal' which clashes with 'curl'
# Install 'curl' for every OS except this rockylinux:9
if [[ "${ID}" = "rocky" ]] && [[ "${VERSION}" != *"9."* ]]; then
package_list="${package_list} curl"
fi
# Install OpenSSL 1.0 compat if needed
if ${install_cmd} -q list compat-openssl10 >/dev/null 2>&1; then
package_list="${package_list} compat-openssl10"
fi
# Install lsb_release if available
if ${install_cmd} -q list redhat-lsb-core >/dev/null 2>&1; then
package_list="${package_list} redhat-lsb-core"
fi
# Install git if not already installed (may be more recent than distro version)
if ! type git > /dev/null 2>&1; then
package_list="${package_list} git"
fi
# Install EPEL repository if needed (required to install 'jq' for CentOS)
if ! ${install_cmd} -q list jq >/dev/null 2>&1; then
${install_cmd} -y install epel-release
remove_epel="true"
fi
fi
# Install zsh if needed
if [ "${INSTALL_ZSH}" = "true" ] && ! type zsh > /dev/null 2>&1; then
package_list="${package_list} zsh"
fi
if [ -n "${package_list}" ]; then
${install_cmd} -y install ${package_list}
fi
# Get to latest versions of all packages
if [ "${UPGRADE_PACKAGES}" = "true" ]; then
${install_cmd} upgrade -y
fi
if [[ "${remove_epel}" = "true" ]]; then
${install_cmd} -y remove epel-release
fi
PACKAGES_ALREADY_INSTALLED="true"
}
# Alpine Linux packages
install_alpine_packages() {
apk update
if [ "${PACKAGES_ALREADY_INSTALLED}" != "true" ]; then
apk add --no-cache \
openssh-client \
gnupg \
procps \
lsof \
htop \
net-tools \
psmisc \
curl \
wget \
rsync \
ca-certificates \
unzip \
zip \
nano \
vim \
less \
jq \
libgcc \
libstdc++ \
krb5-libs \
libintl \
libssl1.1 \
lttng-ust \
tzdata \
userspace-rcu \
zlib \
sudo \
coreutils \
sed \
grep \
which \
ncdu \
shadow \
strace
# Install man pages - package name varies between 3.12 and earlier versions
if apk info man > /dev/null 2>&1; then
apk add --no-cache man man-pages
else
apk add --no-cache mandoc man-pages
fi
# Install git if not already installed (may be more recent than distro version)
if ! type git > /dev/null 2>&1; then
apk add --no-cache git
fi
fi
# Install zsh if needed
if [ "${INSTALL_ZSH}" = "true" ] && ! type zsh > /dev/null 2>&1; then
apk add --no-cache zsh
fi
PACKAGES_ALREADY_INSTALLED="true"
}
# ******************
# ** Main section **
# ******************
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
# Load markers to see which steps have already run
if [ -f "${MARKER_FILE}" ]; then
echo "Marker file found:"
cat "${MARKER_FILE}"
source "${MARKER_FILE}"
fi
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
rm -f /etc/profile.d/00-restore-env.sh
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
chmod +x /etc/profile.d/00-restore-env.sh
# Bring in ID, ID_LIKE, VERSION_ID, VERSION_CODENAME
. /etc/os-release
# Get an adjusted ID independent of distro variants
if [ "${ID}" = "debian" ] || [ "${ID_LIKE}" = "debian" ]; then
ADJUSTED_ID="debian"
elif [[ "${ID}" = "rhel" || "${ID}" = "fedora" || "${ID}" = "mariner" || "${ID_LIKE}" = *"rhel"* || "${ID_LIKE}" = *"fedora"* || "${ID_LIKE}" = *"mariner"* ]]; then
ADJUSTED_ID="rhel"
elif [ "${ID}" = "alpine" ]; then
ADJUSTED_ID="alpine"
else
echo "Linux distro ${ID} not supported."
exit 1
fi
# Install packages for appropriate OS
case "${ADJUSTED_ID}" in
"debian")
install_debian_packages
;;
"rhel")
install_redhat_packages
;;
"alpine")
install_alpine_packages
;;
esac
# If in automatic mode, determine if a user already exists, if not use vscode
if [ "${USERNAME}" = "auto" ] || [ "${USERNAME}" = "automatic" ]; then
if [ "${_REMOTE_USER}" != "root" ]; then
USERNAME="${_REMOTE_USER}"
else
USERNAME=""
POSSIBLE_USERS=("devcontainer" "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=vscode
fi
fi
elif [ "${USERNAME}" = "none" ]; then
USERNAME=root
USER_UID=0
USER_GID=0
fi
# Create or update a non-root user to match UID/GID.
group_name="${USERNAME}"
if id -u ${USERNAME} > /dev/null 2>&1; then
# User exists, update if needed
if [ "${USER_GID}" != "automatic" ] && [ "$USER_GID" != "$(id -g $USERNAME)" ]; then
group_name="$(id -gn $USERNAME)"
groupmod --gid $USER_GID ${group_name}
usermod --gid $USER_GID $USERNAME
fi
if [ "${USER_UID}" != "automatic" ] && [ "$USER_UID" != "$(id -u $USERNAME)" ]; then
usermod --uid $USER_UID $USERNAME
fi
else
# Create user
if [ "${USER_GID}" = "automatic" ]; then
groupadd $USERNAME
else
groupadd --gid $USER_GID $USERNAME
fi
if [ "${USER_UID}" = "automatic" ]; then
useradd -s /bin/bash --gid $USERNAME -m $USERNAME
else
useradd -s /bin/bash --uid $USER_UID --gid $USERNAME -m $USERNAME
fi
fi
# Add add sudo support for non-root user
if [ "${USERNAME}" != "root" ] && [ "${EXISTING_NON_ROOT_USER}" != "${USERNAME}" ]; then
echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME
chmod 0440 /etc/sudoers.d/$USERNAME
EXISTING_NON_ROOT_USER="${USERNAME}"
fi
# *********************************
# ** Shell customization section **
# *********************************
if [ "${USERNAME}" = "root" ]; then
user_home="/root"
# Check if user already has a home directory other than /home/${USERNAME}
elif [ "/home/${USERNAME}" != $( getent passwd $USERNAME | cut -d: -f6 ) ]; then
user_home=$( getent passwd $USERNAME | cut -d: -f6 )
else
user_home="/home/${USERNAME}"
if [ ! -d "${user_home}" ]; then
mkdir -p "${user_home}"
chown ${USERNAME}:${group_name} "${user_home}"
fi
fi
# Restore user .bashrc / .profile / .zshrc defaults from skeleton file if it doesn't exist or is empty
possible_rc_files=( ".bashrc" ".profile" )
[ "$INSTALL_OH_MY_ZSH_CONFIG" == "true" ] && possible_rc_files+=('.zshrc')
[ "$INSTALL_ZSH" == "true" ] && possible_rc_files+=('.zprofile')
for rc_file in "${possible_rc_files[@]}"; do
if [ -f "/etc/skel/${rc_file}" ]; then
if [ ! -e "${user_home}/${rc_file}" ] || [ ! -s "${user_home}/${rc_file}" ]; then
cp "/etc/skel/${rc_file}" "${user_home}/${rc_file}"
chown ${USERNAME}:${group_name} "${user_home}/${rc_file}"
fi
fi
done
# Add RC snippet and custom bash prompt
if [ "${RC_SNIPPET_ALREADY_ADDED}" != "true" ]; then
case "${ADJUSTED_ID}" in
"debian")
global_rc_path="/etc/bash.bashrc"
;;
"rhel")
global_rc_path="/etc/bashrc"
;;
"alpine")
global_rc_path="/etc/bash/bashrc"
# /etc/bash/bashrc does not exist in alpine 3.14 & 3.15
mkdir -p /etc/bash
;;
esac
cat "${FEATURE_DIR}/scripts/rc_snippet.sh" >> ${global_rc_path}
cat "${FEATURE_DIR}/scripts/bash_theme_snippet.sh" >> "${user_home}/.bashrc"
if [ "${USERNAME}" != "root" ]; then
cat "${FEATURE_DIR}/scripts/bash_theme_snippet.sh" >> "/root/.bashrc"
chown ${USERNAME}:${group_name} "${user_home}/.bashrc"
fi
RC_SNIPPET_ALREADY_ADDED="true"
fi
# Optionally configure zsh and Oh My Zsh!
if [ "${INSTALL_ZSH}" = "true" ]; then
if [ ! -f "${user_home}/.zprofile" ]; then
touch "${user_home}/.zprofile"
echo 'source $HOME/.profile' >> "${user_home}/.zprofile" # TODO: Reconsider adding '.profile' to '.zprofile'
chown ${USERNAME}:${group_name} "${user_home}/.zprofile"
fi
if [ "${ZSH_ALREADY_INSTALLED}" != "true" ]; then
if [ "${ADJUSTED_ID}" = "rhel" ]; then
global_rc_path="/etc/zshrc"
else
global_rc_path="/etc/zsh/zshrc"
fi
cat "${FEATURE_DIR}/scripts/rc_snippet.sh" >> ${global_rc_path}
ZSH_ALREADY_INSTALLED="true"
fi
if [ "${CONFIGURE_ZSH_AS_DEFAULT_SHELL}" == "true" ]; then
# Fixing chsh always asking for a password on alpine linux
# ref: https://askubuntu.com/questions/812420/chsh-always-asking-a-password-and-get-pam-authentication-failure.
if [ ! -f "/etc/pam.d/chsh" ] || ! grep -Eq '^auth(.*)pam_rootok\.so$' /etc/pam.d/chsh; then
echo "auth sufficient pam_rootok.so" >> /etc/pam.d/chsh
elif [[ -n "$(awk '/^auth(.*)pam_rootok\.so$/ && !/^auth[[:blank:]]+sufficient[[:blank:]]+pam_rootok\.so$/' /etc/pam.d/chsh)" ]]; then
awk '/^auth(.*)pam_rootok\.so$/ { $2 = "sufficient" } { print }' /etc/pam.d/chsh > /tmp/chsh.tmp && mv /tmp/chsh.tmp /etc/pam.d/chsh
fi
chsh --shell /bin/zsh ${USERNAME}
fi
# Adapted, simplified inline Oh My Zsh! install steps that adds, defaults to a codespaces theme.
# See https://github.com/ohmyzsh/ohmyzsh/blob/master/tools/install.sh for official script.
if [ "${INSTALL_OH_MY_ZSH}" = "true" ]; then
user_rc_file="${user_home}/.zshrc"
oh_my_install_dir="${user_home}/.oh-my-zsh"
template_path="${oh_my_install_dir}/templates/zshrc.zsh-template"
if [ ! -d "${oh_my_install_dir}" ]; then
umask g-w,o-w
mkdir -p ${oh_my_install_dir}
git clone --depth=1 \
-c core.eol=lf \
-c core.autocrlf=false \
-c fsck.zeroPaddedFilemode=ignore \
-c fetch.fsck.zeroPaddedFilemode=ignore \
-c receive.fsck.zeroPaddedFilemode=ignore \
"https://github.com/ohmyzsh/ohmyzsh" "${oh_my_install_dir}" 2>&1
# Shrink git while still enabling updates
cd "${oh_my_install_dir}"
git repack -a -d -f --depth=1 --window=1
fi
# Add Dev Containers theme
mkdir -p ${oh_my_install_dir}/custom/themes
cp -f "${FEATURE_DIR}/scripts/devcontainers.zsh-theme" "${oh_my_install_dir}/custom/themes/devcontainers.zsh-theme"
ln -sf "${oh_my_install_dir}/custom/themes/devcontainers.zsh-theme" "${oh_my_install_dir}/custom/themes/codespaces.zsh-theme"
# Add devcontainer .zshrc template
if [ "$INSTALL_OH_MY_ZSH_CONFIG" = "true" ]; then
echo -e "$(cat "${template_path}")\nDISABLE_AUTO_UPDATE=true\nDISABLE_UPDATE_PROMPT=true" > ${user_rc_file}
sed -i -e 's/ZSH_THEME=.*/ZSH_THEME="devcontainers"/g' ${user_rc_file}
fi
# Copy to non-root user if one is specified
if [ "${USERNAME}" != "root" ]; then
copy_to_user_files=("${oh_my_install_dir}")
[ -f "$user_rc_file" ] && copy_to_user_files+=("$user_rc_file")
cp -rf "${copy_to_user_files[@]}" /root
chown -R ${USERNAME}:${group_name} "${copy_to_user_files[@]}"
fi
fi
fi
# *********************************
# ** Ensure config directory **
# *********************************
user_config_dir="${user_home}/.config"
if [ ! -d "${user_config_dir}" ]; then
mkdir -p "${user_config_dir}"
chown ${USERNAME}:${group_name} "${user_config_dir}"
fi
# ****************************
# ** Utilities and commands **
# ****************************
# code shim, it fallbacks to code-insiders if code is not available
cp -f "${FEATURE_DIR}/bin/code" /usr/local/bin/
chmod +rx /usr/local/bin/code
# systemctl shim for Debian/Ubuntu - tells people to use 'service' if systemd is not running
if [ "${ADJUSTED_ID}" = "debian" ]; then
cp -f "${FEATURE_DIR}/bin/systemctl" /usr/local/bin/systemctl
chmod +rx /usr/local/bin/systemctl
fi
# Persist image metadata info, script if meta.env found in same directory
if [ -f "/usr/local/etc/vscode-dev-containers/meta.env" ] || [ -f "/usr/local/etc/dev-containers/meta.env" ]; then
cp -f "${FEATURE_DIR}/bin/devcontainer-info" /usr/local/bin/devcontainer-info
chmod +rx /usr/local/bin/devcontainer-info
fi
# Write marker file
if [ ! -d "/usr/local/etc/vscode-dev-containers" ]; then
mkdir -p "$(dirname "${MARKER_FILE}")"
fi
echo -e "\
PACKAGES_ALREADY_INSTALLED=${PACKAGES_ALREADY_INSTALLED}\n\
LOCALE_ALREADY_SET=${LOCALE_ALREADY_SET}\n\
EXISTING_NON_ROOT_USER=${EXISTING_NON_ROOT_USER}\n\
RC_SNIPPET_ALREADY_ADDED=${RC_SNIPPET_ALREADY_ADDED}\n\
ZSH_ALREADY_INSTALLED=${ZSH_ALREADY_INSTALLED}" > "${MARKER_FILE}"
echo "Done!"

View file

@ -0,0 +1,25 @@
# bash theme - partly inspired by https://github.com/ohmyzsh/ohmyzsh/blob/master/themes/robbyrussell.zsh-theme
__bash_prompt() {
local userpart='`export XIT=$? \
&& [ ! -z "${GITHUB_USER}" ] && echo -n "\[\033[0;32m\]@${GITHUB_USER} " || echo -n "\[\033[0;32m\]\u " \
&& [ "$XIT" -ne "0" ] && echo -n "\[\033[1;31m\]➜" || echo -n "\[\033[0m\]➜"`'
local gitbranch='`\
if [ "$(git config --get devcontainers-theme.hide-status 2>/dev/null)" != 1 ] && [ "$(git config --get codespaces-theme.hide-status 2>/dev/null)" != 1 ]; then \
export BRANCH=$(git --no-optional-locks symbolic-ref --short HEAD 2>/dev/null || git --no-optional-locks rev-parse --short HEAD 2>/dev/null); \
if [ "${BRANCH}" != "" ]; then \
echo -n "\[\033[0;36m\](\[\033[1;31m\]${BRANCH}" \
&& if [ "$(git config --get devcontainers-theme.show-dirty 2>/dev/null)" = 1 ] && \
git --no-optional-locks ls-files --error-unmatch -m --directory --no-empty-directory -o --exclude-standard ":/*" > /dev/null 2>&1; then \
echo -n " \[\033[1;33m\]✗"; \
fi \
&& echo -n "\[\033[0;36m\]) "; \
fi; \
fi`'
local lightblue='\[\033[1;34m\]'
local removecolor='\[\033[0m\]'
PS1="${userpart} ${lightblue}\w ${gitbranch}${removecolor}\$ "
unset -f __bash_prompt
}
__bash_prompt
export PROMPT_DIRTRIM=4

View file

@ -0,0 +1,26 @@
# Oh My Zsh! theme - partly inspired by https://github.com/ohmyzsh/ohmyzsh/blob/master/themes/robbyrussell.zsh-theme
__zsh_prompt() {
local prompt_username
if [ ! -z "${GITHUB_USER}" ]; then
prompt_username="@${GITHUB_USER}"
else
prompt_username="%n"
fi
PROMPT="%{$fg[green]%}${prompt_username} %(?:%{$reset_color%}➜ :%{$fg_bold[red]%}➜ )" # User/exit code arrow
PROMPT+='%{$fg_bold[blue]%}%(5~|%-1~/…/%3~|%4~)%{$reset_color%} ' # cwd
PROMPT+='`\
if [ "$(git config --get devcontainers-theme.hide-status 2>/dev/null)" != 1 ] && [ "$(git config --get codespaces-theme.hide-status 2>/dev/null)" != 1 ]; then \
export BRANCH=$(git --no-optional-locks symbolic-ref --short HEAD 2>/dev/null || git --no-optional-locks rev-parse --short HEAD 2>/dev/null); \
if [ "${BRANCH}" != "" ]; then \
echo -n "%{$fg_bold[cyan]%}(%{$fg_bold[red]%}${BRANCH}" \
&& if [ "$(git config --get devcontainers-theme.show-dirty 2>/dev/null)" = 1 ] && \
git --no-optional-locks ls-files --error-unmatch -m --directory --no-empty-directory -o --exclude-standard ":/*" > /dev/null 2>&1; then \
echo -n " %{$fg_bold[yellow]%}✗"; \
fi \
&& echo -n "%{$fg_bold[cyan]%})%{$reset_color%} "; \
fi; \
fi`'
PROMPT+='%{$fg[white]%}$ %{$reset_color%}'
unset -f __zsh_prompt
}
__zsh_prompt

View file

@ -0,0 +1,26 @@
if [ -z "${USER}" ]; then export USER=$(whoami); fi
if [[ "${PATH}" != *"$HOME/.local/bin"* ]]; then export PATH="${PATH}:$HOME/.local/bin"; fi
# Display optional first run image specific notice if configured and terminal is interactive
if [ -t 1 ] && [[ "${TERM_PROGRAM}" = "vscode" || "${TERM_PROGRAM}" = "codespaces" ]] && [ ! -f "$HOME/.config/vscode-dev-containers/first-run-notice-already-displayed" ]; then
if [ -f "/usr/local/etc/vscode-dev-containers/first-run-notice.txt" ]; then
cat "/usr/local/etc/vscode-dev-containers/first-run-notice.txt"
elif [ -f "/workspaces/.codespaces/shared/first-run-notice.txt" ]; then
cat "/workspaces/.codespaces/shared/first-run-notice.txt"
fi
mkdir -p "$HOME/.config/vscode-dev-containers"
# Mark first run notice as displayed after 10s to avoid problems with fast terminal refreshes hiding it
((sleep 10s; touch "$HOME/.config/vscode-dev-containers/first-run-notice-already-displayed") &)
fi
# Set the default git editor if not already set
if [ -z "$(git config --get core.editor)" ] && [ -z "${GIT_EDITOR}" ]; then
if [ "${TERM_PROGRAM}" = "vscode" ]; then
if [[ -n $(command -v code-insiders) && -z $(command -v code) ]]; then
export GIT_EDITOR="code-insiders --wait"
else
export GIT_EDITOR="code --wait"
fi
fi
fi

View file

@ -11,3 +11,10 @@ As covered in the [user FAQ](https://docs.anaconda.com/anaconda/user-guide/faq)
```bash
conda install python=3.7
```
## OS Support
This Feature should work on recent versions of Debian/Ubuntu-based distributions with the `apt` package manager installed.
`bash` is required to execute the `install.sh` script.

View file

@ -33,6 +33,13 @@ conda install python=3.7
```
## OS Support
This Feature should work on recent versions of Debian/Ubuntu-based distributions with the `apt` package manager installed.
`bash` is required to execute the `install.sh` script.
---
_Note: This file was auto-generated from the [devcontainer-feature.json](https://github.com/devcontainers/features/blob/main/src/conda/devcontainer-feature.json). Add additional notes to a `NOTES.md`._

View file

@ -1,6 +1,6 @@
{
"id": "conda",
"version": "1.0.5",
"version": "1.0.9",
"name": "Conda",
"description": "A cross-platform, language-agnostic binary package manager",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/conda",

View file

@ -7,7 +7,7 @@
VERSION=${VERSION:-"latest"}
ADD_CONDA_FORGE=$ADDCONDAFORGE
USERNAME="automatic"
USERNAME="${USERNAME:-"${_REMOTE_USER:-"automatic"}"}"
UPDATE_RC="true"
CONDA_DIR="/opt/conda"
@ -61,6 +61,20 @@ check_packages() {
fi
}
sudo_if() {
COMMAND="$*"
if [ "$(id -u)" -eq 0 ] && [ "$USERNAME" != "root" ]; then
su - "$USERNAME" -c "$COMMAND"
else
$COMMAND
fi
}
install_user_package() {
PACKAGE="$1"
sudo_if "${CONDA_DIR}/bin/python3" -m pip install --user --upgrade "$PACKAGE"
}
# Install Conda if it's missing
if ! conda --version &> /dev/null ; then
if ! cat /etc/group | grep -e "^conda:" > /dev/null 2>&1; then
@ -99,6 +113,14 @@ if ! conda --version &> /dev/null ; then
chmod -R g+r+w "${CONDA_DIR}"
find "${CONDA_DIR}" -type d -print0 | xargs -n 1 -0 chmod g+s
# Temporary fixes
# Due to https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-23491
install_user_package certifi
# Due to https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-0286 and https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-23931
install_user_package cryptography
# Due to https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-40897
install_user_package setuptools
fi
# Display a notice on conda when not running in GitHub Codespaces

View file

@ -6,6 +6,16 @@ This feature provides two ways of connecting to the desktop environment it adds.
1. Open the ports view in your tool, select the noVNC port, and click the Globe icon.
1. In the browser that appears, click the **Connect** button and enter the desktop password (`vscode` by default).
To set up the `6080` port from your `devcontainer.json` file, include the following:
```json
"forwardPorts": [6080],
"portsAttributes": {
"6080": {
"label": "desktop"
}
}
```
You can also connect to the desktop using a [VNC viewer](https://www.realvnc.com/en/connect/download/viewer/). To do so:
1. Connect to the environment from a desktop tool that supports the dev container spec (e.g., VS Code client).
@ -15,7 +25,7 @@ You can also connect to the desktop using a [VNC viewer](https://www.realvnc.com
## Customizing Fluxbox
The window manager is installed is [Fluxbox](http://fluxbox.org/). **Right-click** to see the application menu. In addition, any UI-based commands you execute inside the dev container will automatically appear on the desktop.
The window manager installed is [Fluxbox](http://fluxbox.org/). **Right-click** to see the application menu. In addition, any UI-based commands you execute inside the dev container will automatically appear on the desktop.
You can customize the desktop using Fluxbox configuration files. The configuration files are located in the `.fluxbox` folder of the home directory of the user you using to connect to the dev container (`$HOME/.fluxbox`).
@ -62,3 +72,10 @@ If you want the full version of **Google Chrome** in the desktop:
2. Chrome sandbox support requires you set up and run as a non-root user. The [`common-utils`](https://github.com/devcontainers/features/tree/main/src/common-utils) script can do this for you, or you [set one up yourself](https://aka.ms/vscode-remote/containers/non-root). Alternatively, you can start Chrome using `google-chrome --no-sandbox`
That's it!
## OS Support
This Feature should work on recent versions of Debian/Ubuntu-based distributions with the `apt` package manager installed.
`bash` is required to execute the `install.sh` script.

View file

@ -29,6 +29,16 @@ This feature provides two ways of connecting to the desktop environment it adds.
1. Open the ports view in your tool, select the noVNC port, and click the Globe icon.
1. In the browser that appears, click the **Connect** button and enter the desktop password (`vscode` by default).
To set up the `6080` port from your `devcontainer.json` file, include the following:
```json
"forwardPorts": [6080],
"portsAttributes": {
"6080": {
"label": "desktop"
}
}
```
You can also connect to the desktop using a [VNC viewer](https://www.realvnc.com/en/connect/download/viewer/). To do so:
1. Connect to the environment from a desktop tool that supports the dev container spec (e.g., VS Code client).
@ -38,7 +48,7 @@ You can also connect to the desktop using a [VNC viewer](https://www.realvnc.com
## Customizing Fluxbox
The window manager is installed is [Fluxbox](http://fluxbox.org/). **Right-click** to see the application menu. In addition, any UI-based commands you execute inside the dev container will automatically appear on the desktop.
The window manager installed is [Fluxbox](http://fluxbox.org/). **Right-click** to see the application menu. In addition, any UI-based commands you execute inside the dev container will automatically appear on the desktop.
You can customize the desktop using Fluxbox configuration files. The configuration files are located in the `.fluxbox` folder of the home directory of the user you using to connect to the dev container (`$HOME/.fluxbox`).
@ -87,6 +97,13 @@ If you want the full version of **Google Chrome** in the desktop:
That's it!
## OS Support
This Feature should work on recent versions of Debian/Ubuntu-based distributions with the `apt` package manager installed.
`bash` is required to execute the `install.sh` script.
---
_Note: This file was auto-generated from the [devcontainer-feature.json](https://github.com/devcontainers/features/blob/main/src/desktop-lite/devcontainer-feature.json). Add additional notes to a `NOTES.md`._

View file

@ -1,6 +1,6 @@
{
"id": "desktop-lite",
"version": "1.0.5",
"version": "1.0.8",
"name": "Light-weight Desktop",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/desktop-lite",
"description": "Adds a lightweight Fluxbox based desktop to the container that can be accessed using a VNC viewer or the web. GUI-based commands executed from the built-in VS code terminal will open on the desktop automatically.",

View file

@ -7,14 +7,13 @@
# Docs: https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/docs/desktop-lite.md
# Maintainer: The VS Code and Codespaces Teams
NOVNC_VERSION=${NOVNCVERSION:-"1.2.0"} # TODO: Add in a 'latest' auto-detect and swap name to 'version'
NOVNC_VERSION="${NOVNCVERSION:-"1.2.0"}" # TODO: Add in a 'latest' auto-detect and swap name to 'version'
VNC_PASSWORD=${PASSWORD:-"vscode"}
NOVNC_PORT="${WEBPORT:-6080}"
VNC_PORT="${VNCPORT:-5901}"
INSTALL_NOVNC=${INSTALL_NOVNC:-"true"}
USERNAME=${USERNAME:-"automatic"}
INSTALL_NOVNC="${INSTALL_NOVNC:-"true"}"
USERNAME="${USERNAME:-"${_REMOTE_USER:-"automatic"}"}"
WEBSOCKETIFY_VERSION=0.10.0
@ -177,7 +176,7 @@ export DEBIAN_FRONTEND=noninteractive
apt_get_update
# On older Ubuntu, Tilix is in a PPA. on Debian strech its in backports.
# On older Ubuntu, Tilix is in a PPA. on Debian stretch its in backports.
if [[ -z $(apt-cache --names-only search ^tilix$) ]]; then
. /etc/os-release
if [ "${ID}" = "ubuntu" ]; then
@ -300,9 +299,9 @@ startInBackgroundIfNotRunning()
{
log "Starting \$1."
echo -e "\n** \$(date) **" | sudoIf tee -a /tmp/\$1.log > /dev/null
if ! pidof \$1 > /dev/null; then
if ! pgrep -x \$1 > /dev/null; then
keepRunningInBackground "\$@"
while ! pidof \$1 > /dev/null; do
while ! pgrep -x \$1 > /dev/null; do
sleep 1
done
log "\$1 started."
@ -348,16 +347,16 @@ log "** SCRIPT START **"
# Start dbus.
log 'Running "/etc/init.d/dbus start".'
if [ -f "/var/run/dbus/pid" ] && ! pidof dbus-daemon > /dev/null; then
if [ -f "/var/run/dbus/pid" ] && ! pgrep -x dbus-daemon > /dev/null; then
sudoIf rm -f /var/run/dbus/pid
fi
sudoIf /etc/init.d/dbus start 2>&1 | sudoIf tee -a /tmp/dbus-daemon-system.log > /dev/null
while ! pidof dbus-daemon > /dev/null; do
while ! pgrep -x dbus-daemon > /dev/null; do
sleep 1
done
# Startup tigervnc server and fluxbox
sudo rm -rf /tmp/.X11-unix /tmp/.X*-lock
sudoIf rm -rf /tmp/.X11-unix /tmp/.X*-lock
mkdir -p /tmp/.X11-unix
sudoIf chmod 1777 /tmp/.X11-unix
sudoIf chown root:\${group_name} /tmp/.X11-unix
@ -366,7 +365,7 @@ screen_geometry="\${VNC_RESOLUTION%*x*}"
screen_depth="\${VNC_RESOLUTION##*x}"
startInBackgroundIfNotRunning "Xtigervnc" sudoUserIf "tigervncserver \${DISPLAY} -geometry \${screen_geometry} -depth \${screen_depth} -rfbport ${VNC_PORT} -dpi \${VNC_DPI:-96} -localhost -desktop fluxbox -fg -passwd /usr/local/etc/vscode-dev-containers/vnc-passwd"
# Spin up noVNC if installed and not runnning.
# Spin up noVNC if installed and not running.
if [ -d "/usr/local/novnc" ] && [ "\$(ps -ef | grep /usr/local/novnc/noVNC*/utils/launch.sh | grep -v grep)" = "" ]; then
keepRunningInBackground "noVNC" sudoIf "/usr/local/novnc/noVNC*/utils/launch.sh --listen ${NOVNC_PORT} --vnc localhost:${VNC_PORT}"
log "noVNC started."

View file

@ -1,25 +0,0 @@
## Limitations
* As the name implies, the Feature is expected to work when the host is running Docker (or the OSS Moby container engine it is built on). It may be possible to get running in other container engines, but it has not been tested with them.
* The host and the container must be running on the same chip architecture. You will not be able to use it with an emulated x86 image with Docker Desktop on an Apple Silicon Mac, for example.
* This approach does not currently enable bind mounting the workspace folder by default, and cannot support folders outside of the workspace folder. Consider whether the [Docker-in-Docker Feature](../docker-in-docker) would better meet your needs given it does not have this limitation.
## Supporting bind mounts from the workspace folder
A common question that comes up is how you can use `bind` mounts from the Docker CLI from within the a dev container using this Feature (e.g. via `-v`). If you cannot use the [Docker-in-Docker Feature](../docker-in-docker), the only way to work around this is to use the **host**'s folder paths instead of the container's paths.
A simple way to do this is to put `${localWorkspaceFolder}` in an environment variable that you then use when doing bind mounts inside the container.
Add the following to `devcontainer.json`:
```json
"remoteEnv": { "LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}" }
```
Then reference the env var when running Docker commands from the terminal inside the container.
```bash
docker run -it --rm -v ${LOCAL_WORKSPACE_FOLDER}:/workspace debian bash
```
> **Note:** There is no `${localWorkspaceFolder}` when using the **Clone Repository in Container Volume** command in the VS Code Dev Containers extension ([info](https://github.com/microsoft/vscode-remote-release/issues/6160#issuecomment-1014701007)).

View file

@ -1,50 +0,0 @@
# Docker (Docker-from-Docker) (docker-from-docker)
## Example Usage
```json
"features": {
"ghcr.io/devcontainers/features/docker-from-docker:1": {}
}
```
## Options
| Options Id | Description | Type | Default Value |
|-----|-----|-----|-----|
| version | Select or enter a Docker/Moby CLI version. (Availability can vary by OS version.) | string | latest |
| moby | Install OSS Moby build instead of Docker CE | boolean | true |
| dockerDashComposeVersion | Compose version to use for docker-compose (v1 or v2) | string | v1 |
## Limitations
* As the name implies, the Feature is expected to work when the host is running Docker (or the OSS Moby container engine it is built on). It may be possible to get running in other container engines, but it has not been tested with them.
* The host and the container must be running on the same chip architecture. You will not be able to use it with an emulated x86 image with Docker Desktop on an Apple Silicon Mac, for example.
* This approach does not currently enable bind mounting the workspace folder by default, and cannot support folders outside of the workspace folder. Consider whether the [Docker-in-Docker Feature](../docker-in-docker) would better meet your needs given it does not have this limitation.
## Supporting bind mounts from the workspace folder
A common question that comes up is how you can use `bind` mounts from the Docker CLI from within the a dev container using this Feature (e.g. via `-v`). If you cannot use the [Docker-in-Docker Feature](../docker-in-docker), the only way to work around this is to use the **host**'s folder paths instead of the container's paths.
A simple way to do this is to put `${localWorkspaceFolder}` in an environment variable that you then use when doing bind mounts inside the container.
Add the following to `devcontainer.json`:
```json
"remoteEnv": { "LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}" }
```
Then reference the env var when running Docker commands from the terminal inside the container.
```bash
docker run -it --rm -v ${LOCAL_WORKSPACE_FOLDER}:/workspace debian bash
```
> **Note:** There is no `${localWorkspaceFolder}` when using the **Clone Repository in Container Volume** command in the VS Code Dev Containers extension ([info](https://github.com/microsoft/vscode-remote-release/issues/6160#issuecomment-1014701007)).
---
_Note: This file was auto-generated from the [devcontainer-feature.json](https://github.com/devcontainers/features/blob/main/src/docker-from-docker/devcontainer-feature.json). Add additional notes to a `NOTES.md`._

View file

@ -2,5 +2,15 @@
This docker-in-docker Dev Container Feature is roughly based on the [official docker-in-docker wrapper script](https://github.com/moby/moby/blob/master/hack/dind) that is part of the [Moby project](https://mobyproject.org/). With this in mind:
* As the name implies, the Feature is expected to work when the host is running Docker (or the OSS Moby container engine it is built on). It may be possible to get running in other container engines, but it has not been tested with them.
* The host and the container must be running on the same chip architecture. You will not be able to use it with an emulated x86 image with Docker Desktop on an Apple Silicon Mac, for example.
* The host and the container must be running on the same chip architecture. You will not be able to use it with an emulated x86 image with Docker Desktop on an Apple Silicon Mac, like in this example:
```
FROM --platform=linux/amd64 mcr.microsoft.com/devcontainers/typescript-node:16
```
See [Issue #219](https://github.com/devcontainers/features/issues/219) for more details.
## OS Support
This Feature should work on recent versions of Debian/Ubuntu-based distributions with the `apt` package manager installed.
`bash` is required to execute the `install.sh` script.

View file

@ -7,7 +7,7 @@ Create child containers *inside* a container, independent from the host's docker
```json
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:1": {}
"ghcr.io/devcontainers/features/docker-in-docker:2": {}
}
```
@ -17,17 +17,34 @@ Create child containers *inside* a container, independent from the host's docker
|-----|-----|-----|-----|
| version | Select or enter a Docker/Moby Engine version. (Availability can vary by OS version.) | string | latest |
| moby | Install OSS Moby build instead of Docker CE | boolean | true |
| dockerDashComposeVersion | Default version of Docker Compose (v1 or v2) | string | v1 |
| dockerDashComposeVersion | Default version of Docker Compose (v1 or v2 or none) | string | v1 |
| azureDnsAutoDetection | Allow automatically setting the dockerd DNS server when the installation script detects it is running in Azure | boolean | true |
| dockerDefaultAddressPool | Define default address pools for Docker networks. e.g. base=192.168.0.0/16,size=24 | string | - |
| installDockerBuildx | Install Docker Buildx | boolean | true |
## Customizations
### VS Code Extensions
- `ms-azuretools.vscode-docker`
## Limitations
This docker-in-docker Dev Container Feature is roughly based on the [official docker-in-docker wrapper script](https://github.com/moby/moby/blob/master/hack/dind) that is part of the [Moby project](https://mobyproject.org/). With this in mind:
* As the name implies, the Feature is expected to work when the host is running Docker (or the OSS Moby container engine it is built on). It may be possible to get running in other container engines, but it has not been tested with them.
* The host and the container must be running on the same chip architecture. You will not be able to use it with an emulated x86 image with Docker Desktop on an Apple Silicon Mac, for example.
* The host and the container must be running on the same chip architecture. You will not be able to use it with an emulated x86 image with Docker Desktop on an Apple Silicon Mac, like in this example:
```
FROM --platform=linux/amd64 mcr.microsoft.com/devcontainers/typescript-node:16
```
See [Issue #219](https://github.com/devcontainers/features/issues/219) for more details.
## OS Support
This Feature should work on recent versions of Debian/Ubuntu-based distributions with the `apt` package manager installed.
`bash` is required to execute the `install.sh` script.
---

View file

@ -1,6 +1,6 @@
{
"id": "docker-in-docker",
"version": "1.0.8",
"version": "2.7.1",
"name": "Docker (Docker-in-Docker)",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/docker-in-docker",
"description": "Create child containers *inside* a container, independent from the host's docker instance. Installs Docker extension in the container along with needed CLIs.",
@ -23,11 +23,12 @@
"dockerDashComposeVersion": {
"type": "string",
"enum": [
"none",
"v1",
"v2"
],
"default": "v1",
"description": "Default version of Docker Compose (v1 or v2)"
"description": "Default version of Docker Compose (v1 or v2 or none)"
},
"azureDnsAutoDetection": {
"type": "boolean",
@ -39,6 +40,11 @@
"default": "",
"proposals": [],
"description": "Define default address pools for Docker networks. e.g. base=192.168.0.0/16,size=24"
},
"installDockerBuildx": {
"type": "boolean",
"default": true,
"description": "Install Docker Buildx"
}
},
"entrypoint": "/usr/local/share/docker-init.sh",
@ -55,7 +61,7 @@
},
"mounts": [
{
"source": "dind-var-lib-docker",
"source": "dind-var-lib-docker-${devcontainerId}",
"target": "/var/lib/docker",
"type": "volume"
}

View file

@ -5,21 +5,19 @@
#-------------------------------------------------------------------------------------------------------------
#
# Docs: https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/docs/docker-in-docker.md
# Maintainer: The VS Code and Codespaces Teams
# Maintainer: The Dev Container spec maintainers
DOCKER_VERSION=${VERSION:-"latest"} # The Docker/Moby Engine + CLI should match in version
USE_MOBY=${MOBY:-"true"}
DOCKER_DASH_COMPOSE_VERSION=${DOCKERDASHCOMPOSEVERSION:-"v1"} # v1 or v2
AZURE_DNS_AUTO_DETECTION=${AZUREDNSAUTODETECTION:-"true"}
DOCKER_DEFAULT_ADDRESS_POOL=${DOCKERDEFAULTADDRESSPOOL}
ENABLE_NONROOT_DOCKER=${ENABLE_NONROOT_DOCKER:-"true"}
USERNAME=${USERNAME:-"automatic"}
DOCKER_VERSION="${VERSION:-"latest"}" # The Docker/Moby Engine + CLI should match in version
USE_MOBY="${MOBY:-"true"}"
DOCKER_DASH_COMPOSE_VERSION="${DOCKERDASHCOMPOSEVERSION:-"v1"}" # v1 or v2 or none
AZURE_DNS_AUTO_DETECTION="${AZUREDNSAUTODETECTION:-"true"}"
DOCKER_DEFAULT_ADDRESS_POOL="${DOCKERDEFAULTADDRESSPOOL}"
USERNAME="${USERNAME:-"${_REMOTE_USER:-"automatic"}"}"
INSTALL_DOCKER_BUILDX="${INSTALLDOCKERBUILDX:-"true"}"
MICROSOFT_GPG_KEYS_URI="https://packages.microsoft.com/keys/microsoft.asc"
DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES="buster bullseye bionic focal jammy"
DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES="buster bullseye bionic focal hirsute impish jammy"
DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES="bookworm buster bullseye bionic focal jammy"
DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES="bookworm buster bullseye bionic focal hirsute impish jammy"
# Default: Exit on any failure.
set -e
@ -59,21 +57,6 @@ elif [ "${USERNAME}" = "none" ] || ! id -u ${USERNAME} > /dev/null 2>&1; then
USERNAME=root
fi
# Get central common setting
get_common_setting() {
if [ "${common_settings_file_loaded}" != "true" ]; then
curl -sfL "https://aka.ms/vscode-dev-containers/script-library/settings.env" 2>/dev/null -o /tmp/vsdc-settings.env || echo "Could not download settings file. Skipping."
common_settings_file_loaded=true
fi
if [ -f "/tmp/vsdc-settings.env" ]; then
local multi_line=""
if [ "$2" = "true" ]; then multi_line="-z"; fi
local result="$(grep ${multi_line} -oP "$1=\"?\K[^\"]+" /tmp/vsdc-settings.env | tr -d '\0')"
if [ ! -z "${result}" ]; then declare -g $1="${result}"; fi
fi
echo "$1=${!1}"
}
apt_get_update()
{
if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then
@ -137,10 +120,8 @@ export DEBIAN_FRONTEND=noninteractive
# Fetch host/container arch.
architecture="$(dpkg --print-architecture)"
# Check if distro is suppported
# Check if distro is supported
if [ "${USE_MOBY}" = "true" ]; then
# 'get_common_setting' allows attribute to be updated remotely
get_common_setting DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES
if [[ "${DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES}" != *"${VERSION_CODENAME}"* ]]; then
err "Unsupported distribution version '${VERSION_CODENAME}'. To resolve, either: (1) set feature option '\"moby\": false' , or (2) choose a compatible OS distribution"
err "Support distributions include: ${DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES}"
@ -148,7 +129,6 @@ if [ "${USE_MOBY}" = "true" ]; then
fi
echo "Distro codename '${VERSION_CODENAME}' matched filter '${DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES}'"
else
get_common_setting DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES
if [[ "${DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES}" != *"${VERSION_CODENAME}"* ]]; then
err "Unsupported distribution version '${VERSION_CODENAME}'. To resolve, please choose a compatible OS distribution"
err "Support distributions include: ${DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES}"
@ -158,7 +138,7 @@ else
fi
# Install dependencies
check_packages apt-transport-https curl ca-certificates pigz iptables gnupg2 dirmngr
check_packages apt-transport-https curl ca-certificates pigz iptables gnupg2 dirmngr wget
if ! type git > /dev/null 2>&1; then
check_packages git
fi
@ -179,7 +159,6 @@ if [ "${USE_MOBY}" = "true" ]; then
cli_package_name="moby-cli"
# Import key safely and import Microsoft apt repo
get_common_setting MICROSOFT_GPG_KEYS_URI
curl -sSL ${MICROSOFT_GPG_KEYS_URI} | gpg --dearmor > /usr/share/keyrings/microsoft-archive-keyring.gpg
echo "deb [arch=${architecture} signed-by=/usr/share/keyrings/microsoft-archive-keyring.gpg] https://packages.microsoft.com/repos/microsoft-${ID}-${VERSION_CODENAME}-prod ${VERSION_CODENAME} main" > /etc/apt/sources.list.d/microsoft.list
else
@ -244,10 +223,12 @@ fi
echo "Finished installing docker / moby!"
# Install Docker Compose if not already installed and is on a supported architecture
if type docker-compose > /dev/null 2>&1; then
# If 'docker-compose' command is to be included
if [ "${DOCKER_DASH_COMPOSE_VERSION}" != "none" ]; then
# Install Docker Compose if not already installed and is on a supported architecture
if type docker-compose > /dev/null 2>&1; then
echo "Docker Compose v1 already installed."
else
else
target_compose_arch="${architecture}"
if [ "${target_compose_arch}" = "amd64" ]; then
target_compose_arch="x86_64"
@ -265,7 +246,21 @@ else
pip3 install --disable-pip-version-check --no-cache-dir --user pipx
pipx_bin=/tmp/pip-tmp/bin/pipx
fi
set +e
${pipx_bin} install --pip-args '--no-cache-dir --force-reinstall' docker-compose
exit_code=$?
set -e
if [ ${exit_code} -ne 0 ]; then
# Temporary: https://github.com/devcontainers/features/issues/616
# See https://github.com/yaml/pyyaml/issues/601
echo "(*) Failed to install docker-compose via pipx. Trying via pip3..."
export PYTHONUSERBASE=/usr/local
pip3 install --disable-pip-version-check --no-cache-dir --user "Cython<3.0" pyyaml wheel docker-compose --no-build-isolation
fi
rm -rf /tmp/pip-tmp
else
compose_v1_version="1"
@ -274,12 +269,12 @@ else
curl -fsSL "https://github.com/docker/compose/releases/download/${compose_v1_version}/docker-compose-Linux-x86_64" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
fi
fi
fi
# Install docker-compose switch if not already installed - https://github.com/docker/compose-switch#manual-installation
current_v1_compose_path="$(which docker-compose)"
target_v1_compose_path="$(dirname "${current_v1_compose_path}")/docker-compose-v1"
if ! type compose-switch > /dev/null 2>&1; then
# Install docker-compose switch if not already installed - https://github.com/docker/compose-switch#manual-installation
current_v1_compose_path="$(which docker-compose)"
target_v1_compose_path="$(dirname "${current_v1_compose_path}")/docker-compose-v1"
if ! type compose-switch > /dev/null 2>&1; then
echo "(*) Installing compose-switch..."
compose_switch_version="latest"
find_version_from_git_tags compose_switch_version "https://github.com/docker/compose-switch"
@ -291,11 +286,12 @@ if ! type compose-switch > /dev/null 2>&1; then
mv "${current_v1_compose_path}" "${target_v1_compose_path}"
update-alternatives --install /usr/local/bin/docker-compose docker-compose /usr/local/bin/compose-switch 99
update-alternatives --install /usr/local/bin/docker-compose docker-compose "${target_v1_compose_path}" 1
fi
if [ "${DOCKER_DASH_COMPOSE_VERSION}" = "v1" ]; then
fi
if [ "${DOCKER_DASH_COMPOSE_VERSION}" = "v1" ]; then
update-alternatives --set docker-compose "${target_v1_compose_path}"
else
else
update-alternatives --set docker-compose /usr/local/bin/compose-switch
fi
fi
# If init file already exists, exit
@ -305,15 +301,29 @@ if [ -f "/usr/local/share/docker-init.sh" ]; then
rm -rf /var/lib/apt/lists/*
exit 0
fi
echo "docker-init doesnt exist, adding..."
echo "docker-init doesn't exist, adding..."
# Add user to the docker group
if [ "${ENABLE_NONROOT_DOCKER}" = "true" ]; then
if ! getent group docker > /dev/null 2>&1; then
groupadd docker
fi
if ! cat /etc/group | grep -e "^docker:" > /dev/null 2>&1; then
groupadd -r docker
fi
usermod -aG docker ${USERNAME}
usermod -aG docker ${USERNAME}
if [ "${INSTALL_DOCKER_BUILDX}" = "true" ]; then
buildx_version="latest"
find_version_from_git_tags buildx_version "https://github.com/docker/buildx" "refs/tags/v"
echo "(*) Installing buildx ${buildx_version}..."
buildx_file_name="buildx-v${buildx_version}.linux-${architecture}"
cd /tmp && wget "https://github.com/docker/buildx/releases/download/v${buildx_version}/${buildx_file_name}"
mkdir -p ${_REMOTE_USER_HOME}/.docker/cli-plugins
mv ${buildx_file_name} ${_REMOTE_USER_HOME}/.docker/cli-plugins/docker-buildx
chmod +x ${_REMOTE_USER_HOME}/.docker/cli-plugins/docker-buildx
chown -R "${USERNAME}:docker" "${_REMOTE_USER_HOME}/.docker"
chmod -R g+r+w "${_REMOTE_USER_HOME}/.docker"
find "${_REMOTE_USER_HOME}/.docker" -type d -print0 | xargs -n 1 -0 chmod g+s
fi
tee /usr/local/share/docker-init.sh > /dev/null \
@ -334,11 +344,10 @@ tee -a /usr/local/share/docker-init.sh > /dev/null \
<< 'EOF'
dockerd_start="AZURE_DNS_AUTO_DETECTION=${AZURE_DNS_AUTO_DETECTION} DOCKER_DEFAULT_ADDRESS_POOL=${DOCKER_DEFAULT_ADDRESS_POOL} $(cat << 'INNEREOF'
# explicitly remove dockerd and containerd PID file to ensure that it can start properly if it was stopped uncleanly
# ie: docker kill <ID>
find /run /var/run -iname 'docker*.pid' -delete || :
find /run /var/run -iname 'container*.pid' -delete || :
## Dind wrapper script from docker team, adapted to a function
# -- Start: dind wrapper script --
# Maintained: https://github.com/moby/moby/blob/master/hack/dind
export container=docker
@ -355,6 +364,8 @@ dockerd_start="AZURE_DNS_AUTO_DETECTION=${AZURE_DNS_AUTO_DETECTION} DOCKER_DEFAU
mount -t tmpfs none /tmp
fi
set_cgroup_nesting()
{
# cgroup v2: enable nesting
if [ -f /sys/fs/cgroup/cgroup.controllers ]; then
# move the processes from the root group to the /init group,
@ -366,11 +377,31 @@ dockerd_start="AZURE_DNS_AUTO_DETECTION=${AZURE_DNS_AUTO_DETECTION} DOCKER_DEFAU
sed -e 's/ / +/g' -e 's/^/+/' < /sys/fs/cgroup/cgroup.controllers \
> /sys/fs/cgroup/cgroup.subtree_control
fi
## Dind wrapper over.
}
# Set cgroup nesting, retrying if necessary
retry_cgroup_nesting=0
until [ "${retry_cgroup_nesting}" -eq "5" ];
do
set +e
set_cgroup_nesting
if [ $? -ne 0 ]; then
echo "(*) cgroup v2: Failed to enable nesting, retrying..."
else
break
fi
retry_cgroup_nesting=`expr $retry_cgroup_nesting + 1`
set -e
done
# -- End: dind wrapper script --
# Handle DNS
set +e
cat /etc/resolv.conf | grep -i 'internal.cloudapp.net'
cat /etc/resolv.conf | grep -i 'internal.cloudapp.net' > /dev/null 2>&1
if [ $? -eq 0 ] && [ "${AZURE_DNS_AUTO_DETECTION}" = "true" ]
then
echo "Setting dockerd Azure DNS."
@ -379,7 +410,6 @@ dockerd_start="AZURE_DNS_AUTO_DETECTION=${AZURE_DNS_AUTO_DETECTION} DOCKER_DEFAU
echo "Not setting dockerd DNS manually."
CUSTOMDNS=""
fi
set -e
if [ -z "$DOCKER_DEFAULT_ADDRESS_POOL" ]
@ -394,14 +424,49 @@ dockerd_start="AZURE_DNS_AUTO_DETECTION=${AZURE_DNS_AUTO_DETECTION} DOCKER_DEFAU
INNEREOF
)"
# Start using sudo if not invoked as root
if [ "$(id -u)" -ne 0 ]; then
sudo /bin/sh -c "${dockerd_start}"
else
eval "${dockerd_start}"
fi
sudo_if() {
COMMAND="$*"
set +e
if [ "$(id -u)" -ne 0 ]; then
sudo $COMMAND
else
$COMMAND
fi
}
retry_docker_start_count=0
docker_ok="false"
until [ "${docker_ok}" = "true" ] || [ "${retry_docker_start_count}" -eq "5" ];
do
# Start using sudo if not invoked as root
if [ "$(id -u)" -ne 0 ]; then
sudo /bin/sh -c "${dockerd_start}"
else
eval "${dockerd_start}"
fi
retry_count=0
until [ "${docker_ok}" = "true" ] || [ "${retry_count}" -eq "5" ];
do
sleep 1s
set +e
docker info > /dev/null 2>&1 && docker_ok="true"
set -e
retry_count=`expr $retry_count + 1`
done
if [ "${docker_ok}" != "true" ] && [ "${retry_docker_start_count}" != "4" ]; then
echo "(*) Failed to start docker, retrying..."
set +e
sudo_if pkill dockerd
sudo_if pkill containerd
set -e
fi
retry_docker_start_count=`expr $retry_docker_start_count + 1`
done
# Execute whatever commands were passed in (if any). This allows us
# to set this script to ENTRYPOINT while still executing the default CMD.

View file

@ -0,0 +1,61 @@
## Limitations
- As the name implies, the Feature is expected to work when the host is running Docker (or the OSS Moby container engine it is built on). It may be possible to get running in other container engines, but it has not been tested with them.
- The host and the container must be running on the same chip architecture. You will not be able to use it with an emulated x86 image with Docker Desktop on an Apple Silicon Mac, for example.
- This approach does not currently enable bind mounting the workspace folder by default, and cannot support folders outside of the workspace folder. Consider whether the [Docker-in-Docker Feature](../docker-in-docker) would better meet your needs given it does not have this limitation.
## Supporting bind mounts from the workspace folder
A common question that comes up is how you can use `bind` mounts from the Docker CLI from within the a dev container using this Feature (e.g. via `-v`). If you cannot use the [Docker-in-Docker Feature](../docker-in-docker), the only way to work around this is to use the **host**'s folder paths instead of the container's paths. There are 2 ways to do this
### 1. Use the `${localWorkspaceFolder}` as environment variable in your code
1. Add the following to `devcontainer.json`:
```json
"remoteEnv": { "LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}" }
```
2. Usage with Docker commands
```bash
docker run -it --rm -v ${LOCAL_WORKSPACE_FOLDER}:/workspace debian bash
```
3. Usage with Docker-compose
```yaml
version: "3.9"
services:
debian:
image: debian
volumes:
- ${LOCAL_WORKSPACE_FOLDER:-./}:/workspace
```
- The defaults value `./` is added so that the `docker-compose.yaml` file can work when it is run outside of the container
### Change the workspace to `${localWorkspaceFolder}`
- This is useful if we don't want to edit the `docker-compose.yaml` file
1. Add the following to `devcontainer.json`
```json
"workspaceFolder": "${localWorkspaceFolder}",
"workspaceMount": "source=${localWorkspaceFolder},target=${localWorkspaceFolder},type=bind"
```
2. Rebuild the container.
3. When the container first started with this settings, select the Workspace with the absolute path to the working directory inside the container
4. Docker commands with bind mount should work as they did outside of the devcontainer
> **Note:** There is no `${localWorkspaceFolder}` when using the **Clone Repository in Container Volume** command in the VS Code Dev Containers extension ([info](https://github.com/microsoft/vscode-remote-release/issues/6160#issuecomment-1014701007)).
## OS Support
This Feature should work on recent versions of Debian/Ubuntu-based distributions with the `apt` package manager installed.
`bash` is required to execute the `install.sh` script.

View file

@ -0,0 +1,96 @@
### **IMPORTANT NOTE**
- **Ids used to publish this Feature in the past - 'docker-from-docker'**
# Docker (docker-outside-of-docker) (docker-outside-of-docker)
Re-use the host docker socket, adding the Docker CLI to a container. Feature invokes a script to enable using a forwarded Docker socket within a container to run Docker commands.
## Example Usage
```json
"features": {
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {}
}
```
## Options
| Options Id | Description | Type | Default Value |
|-----|-----|-----|-----|
| version | Select or enter a Docker/Moby CLI version. (Availability can vary by OS version.) | string | latest |
| moby | Install OSS Moby build instead of Docker CE | boolean | true |
| dockerDashComposeVersion | Compose version to use for docker-compose (v1 or v2 or none) | string | v2 |
| installDockerBuildx | Install Docker Buildx | boolean | true |
## Customizations
### VS Code Extensions
- `ms-azuretools.vscode-docker`
## Limitations
- As the name implies, the Feature is expected to work when the host is running Docker (or the OSS Moby container engine it is built on). It may be possible to get running in other container engines, but it has not been tested with them.
- The host and the container must be running on the same chip architecture. You will not be able to use it with an emulated x86 image with Docker Desktop on an Apple Silicon Mac, for example.
- This approach does not currently enable bind mounting the workspace folder by default, and cannot support folders outside of the workspace folder. Consider whether the [Docker-in-Docker Feature](../docker-in-docker) would better meet your needs given it does not have this limitation.
## Supporting bind mounts from the workspace folder
A common question that comes up is how you can use `bind` mounts from the Docker CLI from within the a dev container using this Feature (e.g. via `-v`). If you cannot use the [Docker-in-Docker Feature](../docker-in-docker), the only way to work around this is to use the **host**'s folder paths instead of the container's paths. There are 2 ways to do this
### 1. Use the `${localWorkspaceFolder}` as environment variable in your code
1. Add the following to `devcontainer.json`:
```json
"remoteEnv": { "LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}" }
```
2. Usage with Docker commands
```bash
docker run -it --rm -v ${LOCAL_WORKSPACE_FOLDER}:/workspace debian bash
```
3. Usage with Docker-compose
```yaml
version: "3.9"
services:
debian:
image: debian
volumes:
- ${LOCAL_WORKSPACE_FOLDER:-./}:/workspace
```
- The defaults value `./` is added so that the `docker-compose.yaml` file can work when it is run outside of the container
### Change the workspace to `${localWorkspaceFolder}`
- This is useful if we don't want to edit the `docker-compose.yaml` file
1. Add the following to `devcontainer.json`
```json
"workspaceFolder": "${localWorkspaceFolder}",
"workspaceMount": "source=${localWorkspaceFolder},target=${localWorkspaceFolder},type=bind"
```
2. Rebuild the container.
3. When the container first started with this settings, select the Workspace with the absolute path to the working directory inside the container
4. Docker commands with bind mount should work as they did outside of the devcontainer
> **Note:** There is no `${localWorkspaceFolder}` when using the **Clone Repository in Container Volume** command in the VS Code Dev Containers extension ([info](https://github.com/microsoft/vscode-remote-release/issues/6160#issuecomment-1014701007)).
## OS Support
This Feature should work on recent versions of Debian/Ubuntu-based distributions with the `apt` package manager installed.
`bash` is required to execute the `install.sh` script.
---
_Note: This file was auto-generated from the [devcontainer-feature.json](https://github.com/devcontainers/features/blob/main/src/docker-outside-of-docker/devcontainer-feature.json). Add additional notes to a `NOTES.md`._

View file

@ -1,9 +1,9 @@
{
"id": "docker-from-docker",
"version": "1.0.6",
"name": "Docker (Docker-from-Docker)",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/docker-from-docker",
"descripton": "Re-use the host docker socket, adding the Docker CLI to a container. Feature invokes a script to enable using a forwarded Docker socket within a container to run Docker commands.",
"id": "docker-outside-of-docker",
"version": "1.3.1",
"name": "Docker (docker-outside-of-docker)",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/docker-outside-of-docker",
"description": "Re-use the host docker socket, adding the Docker CLI to a container. Feature invokes a script to enable using a forwarded Docker socket within a container to run Docker commands.",
"options": {
"version": {
"type": "string",
@ -23,17 +23,20 @@
"dockerDashComposeVersion": {
"type": "string",
"enum": [
"none",
"v1",
"v2"
],
"default": "v1",
"description": "Compose version to use for docker-compose (v1 or v2)"
"default": "v2",
"description": "Compose version to use for docker-compose (v1 or v2 or none)"
},
"installDockerBuildx": {
"type": "boolean",
"default": true,
"description": "Install Docker Buildx"
}
},
"entrypoint": "/usr/local/share/docker-init.sh",
"containerEnv": {
"DOCKER_BUILDKIT": "1"
},
"customizations": {
"vscode": {
"extensions": [
@ -50,5 +53,8 @@
],
"installsAfter": [
"ghcr.io/devcontainers/features/common-utils"
],
"legacyIds": [
"docker-from-docker"
]
}

View file

@ -7,18 +7,19 @@
# Docs: https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/docs/docker.md
# Maintainer: The VS Code and Codespaces Teams
DOCKER_VERSION=${VERSION:-"latest"}
USE_MOBY=${MOBY:-"true"}
DOCKER_DASH_COMPOSE_VERSION=${DOCKERDASHCOMPOSEVERSION:-"v1"} # v1 or v2
DOCKER_VERSION="${VERSION:-"latest"}"
USE_MOBY="${MOBY:-"true"}"
DOCKER_DASH_COMPOSE_VERSION="${DOCKERDASHCOMPOSEVERSION:-"v1"}" # v1 or v2 or none
ENABLE_NONROOT_DOCKER=${ENABLE_NONROOT_DOCKER:-"true"}
SOURCE_SOCKET=${SOURCE_SOCKET:-"/var/run/docker-host.sock"}
TARGET_SOCKET=${TARGET_SOCKET:-"/var/run/docker.sock"}
USERNAME=${USERNAME:-"automatic"}
ENABLE_NONROOT_DOCKER="${ENABLE_NONROOT_DOCKER:-"true"}"
SOURCE_SOCKET="${SOURCE_SOCKET:-"/var/run/docker-host.sock"}"
TARGET_SOCKET="${TARGET_SOCKET:-"/var/run/docker.sock"}"
USERNAME="${USERNAME:-"${_REMOTE_USER:-"automatic"}"}"
INSTALL_DOCKER_BUILDX="${INSTALLDOCKERBUILDX:-"true"}"
MICROSOFT_GPG_KEYS_URI="https://packages.microsoft.com/keys/microsoft.asc"
DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES="buster bullseye bionic focal jammy"
DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES="buster bullseye bionic focal hirsute impish jammy"
DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES="bookworm buster bullseye bionic focal jammy"
DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES="bookworm buster bullseye bionic focal hirsute impish jammy"
set -e
@ -47,21 +48,6 @@ elif [ "${USERNAME}" = "none" ] || ! id -u ${USERNAME} > /dev/null 2>&1; then
USERNAME=root
fi
# Get central common setting
get_common_setting() {
if [ "${common_settings_file_loaded}" != "true" ]; then
curl -sfL "https://aka.ms/vscode-dev-containers/script-library/settings.env" 2>/dev/null -o /tmp/vsdc-settings.env || echo "Could not download settings file. Skipping."
common_settings_file_loaded=true
fi
if [ -f "/tmp/vsdc-settings.env" ]; then
local multi_line=""
if [ "$2" = "true" ]; then multi_line="-z"; fi
local result="$(grep ${multi_line} -oP "$1=\"?\K[^\"]+" /tmp/vsdc-settings.env | tr -d '\0')"
if [ ! -z "${result}" ]; then declare -g $1="${result}"; fi
fi
echo "$1=${!1}"
}
apt_get_update()
{
if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then
@ -116,7 +102,7 @@ find_version_from_git_tags() {
export DEBIAN_FRONTEND=noninteractive
# Install dependencies
check_packages apt-transport-https curl ca-certificates gnupg2 dirmngr
check_packages apt-transport-https curl ca-certificates gnupg2 dirmngr wget
if ! type git > /dev/null 2>&1; then
check_packages git
fi
@ -126,10 +112,8 @@ fi
# Fetch host/container arch.
architecture="$(dpkg --print-architecture)"
# Check if distro is suppported
# Check if distro is supported
if [ "${USE_MOBY}" = "true" ]; then
# 'get_common_setting' allows attribute to be updated remotely
get_common_setting DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES
if [[ "${DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES}" != *"${VERSION_CODENAME}"* ]]; then
err "Unsupported distribution version '${VERSION_CODENAME}'. To resolve, either: (1) set feature option '\"moby\": false' , or (2) choose a compatible OS distribution"
err "Support distributions include: ${DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES}"
@ -137,7 +121,6 @@ if [ "${USE_MOBY}" = "true" ]; then
fi
echo "Distro codename '${VERSION_CODENAME}' matched filter '${DOCKER_MOBY_ARCHIVE_VERSION_CODENAMES}'"
else
get_common_setting DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES
if [[ "${DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES}" != *"${VERSION_CODENAME}"* ]]; then
err "Unsupported distribution version '${VERSION_CODENAME}'. To resolve, please choose a compatible OS distribution"
err "Support distributions include: ${DOCKER_LICENSED_ARCHIVE_VERSION_CODENAMES}"
@ -152,7 +135,6 @@ if [ "${USE_MOBY}" = "true" ]; then
cli_package_name="moby-cli"
# Import key safely and import Microsoft apt repo
get_common_setting MICROSOFT_GPG_KEYS_URI
curl -sSL ${MICROSOFT_GPG_KEYS_URI} | gpg --dearmor > /usr/share/keyrings/microsoft-archive-keyring.gpg
echo "deb [arch=${architecture} signed-by=/usr/share/keyrings/microsoft-archive-keyring.gpg] https://packages.microsoft.com/repos/microsoft-${ID}-${VERSION_CODENAME}-prod ${VERSION_CODENAME} main" > /etc/apt/sources.list.d/microsoft.list
else
@ -193,23 +175,40 @@ if type docker > /dev/null 2>&1; then
echo "Docker / Moby CLI already installed."
else
if [ "${USE_MOBY}" = "true" ]; then
apt-get -y install --no-install-recommends moby-cli${cli_version_suffix} moby-buildx
buildx=()
if [ "${INSTALL_DOCKER_BUILDX}" = "true" ]; then
buildx=(moby-buildx)
fi
apt-get -y install --no-install-recommends ${cli_package_name}${cli_version_suffix} "${buildx[@]}"
apt-get -y install --no-install-recommends moby-compose || echo "(*) Package moby-compose (Docker Compose v2) not available for OS ${ID} ${VERSION_CODENAME} (${architecture}). Skipping."
else
apt-get -y install --no-install-recommends docker-ce-cli${cli_version_suffix}
buildx=()
if [ "${INSTALL_DOCKER_BUILDX}" = "true" ]; then
buildx=(docker-buildx-plugin)
fi
apt-get -y install --no-install-recommends ${cli_package_name}${cli_version_suffix} "${buildx[@]}" docker-compose-plugin
buildx_path="/usr/libexec/docker/cli-plugins/docker-buildx"
# Older versions of Docker CE installs buildx as part of the CLI package
if [ "${INSTALL_DOCKER_BUILDX}" = "false" ] && [ -f "${buildx_path}" ]; then
echo "(*) Removing docker-buildx installed from docker-ce-cli since installDockerBuildx is disabled..."
rm -f "${buildx_path}"
fi
fi
unset buildx buildx_path
fi
# Install Docker Compose if not already installed and is on a supported architecture
if type docker-compose > /dev/null 2>&1; then
# If 'docker-compose' command is to be included
if [ "${DOCKER_DASH_COMPOSE_VERSION}" != "none" ]; then
# Install Docker Compose if not already installed and is on a supported architecture
if type docker-compose > /dev/null 2>&1; then
echo "Docker Compose already installed."
else
elif [ "${DOCKER_DASH_COMPOSE_VERSION}" = "v1" ]; then
TARGET_COMPOSE_ARCH="$(uname -m)"
if [ "${TARGET_COMPOSE_ARCH}" = "amd64" ]; then
TARGET_COMPOSE_ARCH="x86_64"
fi
if [ "${TARGET_COMPOSE_ARCH}" != "x86_64" ]; then
# Use pip to get a version that runns on this architecture
# Use pip to get a version that runs on this architecture
check_packages python3-minimal python3-pip libffi-dev python3-venv
export PIPX_HOME=/usr/local/pipx
mkdir -p ${PIPX_HOME}
@ -230,37 +229,39 @@ else
curl -fsSL "https://github.com/docker/compose/releases/download/${compose_v1_version}/docker-compose-Linux-x86_64" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
fi
fi
# Install docker-compose switch if not already installed - https://github.com/docker/compose-switch#manual-installation
current_v1_compose_path="$(which docker-compose)"
target_v1_compose_path="$(dirname "${current_v1_compose_path}")/docker-compose-v1"
if ! type compose-switch > /dev/null 2>&1; then
echo "(*) Installing compose-switch..."
else
echo "(*) Installing compose-switch as docker-compose..."
compose_switch_version="latest"
find_version_from_git_tags compose_switch_version "https://github.com/docker/compose-switch"
curl -fsSL "https://github.com/docker/compose-switch/releases/download/v${compose_switch_version}/docker-compose-linux-${architecture}" -o /usr/local/bin/compose-switch
chmod +x /usr/local/bin/compose-switch
curl -fsSL "https://github.com/docker/compose-switch/releases/download/v${compose_switch_version}/docker-compose-linux-${architecture}" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
# TODO: Verify checksum once available: https://github.com/docker/compose-switch/issues/11
fi
fi
# Setup v1 CLI as alternative in addition to compose-switch (which maps to v2)
mv "${current_v1_compose_path}" "${target_v1_compose_path}"
update-alternatives --install /usr/local/bin/docker-compose docker-compose /usr/local/bin/compose-switch 99
update-alternatives --install /usr/local/bin/docker-compose docker-compose "${target_v1_compose_path}" 1
fi
if [ "${DOCKER_DASH_COMPOSE_VERSION}" = "v1" ]; then
update-alternatives --set docker-compose "${target_v1_compose_path}"
else
update-alternatives --set docker-compose /usr/local/bin/compose-switch
# Setup a docker group in the event the docker socket's group is not root
if ! grep -qE '^docker:' /etc/group; then
echo "(*) Creating missing docker group..."
groupadd --system docker
fi
# Remarking this out to restore functionality in Azure VMs. ID 999 is a reserved group ID
# Ensure docker group gid is 999
# if [ "$(getent group docker | cut -d: -f3)" != "999" ]; then
# echo "(*) Updating docker group gid to 999..."
# groupmod -g 999 docker
# fi
usermod -aG docker "${USERNAME}"
# If init file already exists, exit
if [ -f "/usr/local/share/docker-init.sh" ]; then
# Clean up
rm -rf /var/lib/apt/lists/*
exit 0
fi
echo "docker-init doesnt exist, adding..."
echo "docker-init doesn't exist, adding..."
# By default, make the source and target sockets the same
if [ "${SOURCE_SOCKET}" != "${TARGET_SOCKET}" ]; then
@ -277,11 +278,6 @@ if [ "${ENABLE_NONROOT_DOCKER}" = "false" ] || [ "${USERNAME}" = "root" ]; then
exit 0
fi
# Setup a docker group in the event the docker socket's group is not root
if ! grep -qE '^docker:' /etc/group; then
groupadd --system docker
fi
usermod -aG docker "${USERNAME}"
DOCKER_GID="$(grep -oP '^docker:x:\K[^:]+' /etc/group)"
# If enabling non-root access and specified user is found, setup socat and add script

74
src/dotnet/NOTES.md Normal file
View file

@ -0,0 +1,74 @@
## Configuration examples
Installing only the latest .NET SDK version (the default).
``` json
{
"features": {
"ghcr.io/devcontainers/features/dotnet:2": "latest" // or "" or {}
}
```
Installing an additional SDK version. Multiple versions can be specified as comma-separated values.
``` json
{
"features": {
"ghcr.io/devcontainers/features/dotnet:2": {
"additionalVersions": "lts"
}
}
```
Installing specific SDK versions.
``` json
{
"features": {
"ghcr.io/devcontainers/features/dotnet:2": {
"version": "6.0",
"additionalVersions": "7.0, 8.0"
}
}
```
Installing a specific SDK feature band.
``` json
{
"features": {
"ghcr.io/devcontainers/features/dotnet:2": {
"version": "6.0.4xx",
}
}
```
Installing a specific SDK patch version.
``` json
{
"features": {
"ghcr.io/devcontainers/features/dotnet:2": {
"version": "6.0.412",
}
}
```
Installing only the .NET Runtime or the ASP.NET Core Runtime. (The SDK includes all runtimes so this configuration is only useful if you need to run .NET apps without building them from source.)
``` json
{
"features": {
"ghcr.io/devcontainers/features/dotnet:2": {
"version": "none",
"dotnetRuntimeVersions": "latest, lts",
"aspnetCoreRuntimeVersions": "latest, lts",
}
}
```
## OS Support
This Feature should work on recent versions of Debian/Ubuntu-based distributions with the `apt` package manager installed.
`bash` is required to execute the `install.sh` script.

View file

@ -1,13 +1,13 @@
# Dotnet CLI (dotnet)
Installs the .NET CLI. Provides option of installing sdk or runtime, and option of versions to install. Uses latest version of .NET sdk as defaults to install.
This Feature installs the latest .NET SDK, which includes the .NET CLI and the shared runtime. Options are provided to choose a different version or additional versions.
## Example Usage
```json
"features": {
"ghcr.io/devcontainers/features/dotnet:1": {}
"ghcr.io/devcontainers/features/dotnet:2": {}
}
```
@ -15,10 +15,91 @@ Installs the .NET CLI. Provides option of installing sdk or runtime, and option
| Options Id | Description | Type | Default Value |
|-----|-----|-----|-----|
| version | Select or enter a dotnet CLI version. (Available versions may vary by Linux distribution.) | string | latest |
| runtimeOnly | Install just the dotnet runtime if true, and sdk if false. | boolean | false |
| installUsingApt | If true, it installs using apt instead of the release URL | boolean | true |
| version | Select or enter a .NET SDK version. Use 'latest' for the latest version, 'lts' for the latest LTS version, 'X.Y' or 'X.Y.Z' for a specific version. | string | latest |
| additionalVersions | Enter additional .NET SDK versions, separated by commas. Use 'latest' for the latest version, 'lts' for the latest LTS version, 'X.Y' or 'X.Y.Z' for a specific version. | string | - |
| dotnetRuntimeVersions | Enter additional .NET runtime versions, separated by commas. Use 'latest' for the latest version, 'lts' for the latest LTS version, 'X.Y' or 'X.Y.Z' for a specific version. | string | - |
| aspNetCoreRuntimeVersions | Enter additional ASP.NET Core runtime versions, separated by commas. Use 'latest' for the latest version, 'lts' for the latest LTS version, 'X.Y' or 'X.Y.Z' for a specific version. | string | - |
## Customizations
### VS Code Extensions
- `ms-dotnettools.csharp`
## Configuration examples
Installing only the latest .NET SDK version (the default).
``` json
{
"features": {
"ghcr.io/devcontainers/features/dotnet:2": "latest" // or "" or {}
}
```
Installing an additional SDK version. Multiple versions can be specified as comma-separated values.
``` json
{
"features": {
"ghcr.io/devcontainers/features/dotnet:2": {
"additionalVersions": "lts"
}
}
```
Installing specific SDK versions.
``` json
{
"features": {
"ghcr.io/devcontainers/features/dotnet:2": {
"version": "6.0",
"additionalVersions": "7.0, 8.0"
}
}
```
Installing a specific SDK feature band.
``` json
{
"features": {
"ghcr.io/devcontainers/features/dotnet:2": {
"version": "6.0.4xx",
}
}
```
Installing a specific SDK patch version.
``` json
{
"features": {
"ghcr.io/devcontainers/features/dotnet:2": {
"version": "6.0.412",
}
}
```
Installing only the .NET Runtime or the ASP.NET Core Runtime. (The SDK includes all runtimes so this configuration is only useful if you need to run .NET apps without building them from source.)
``` json
{
"features": {
"ghcr.io/devcontainers/features/dotnet:2": {
"version": "none",
"dotnetRuntimeVersions": "latest, lts",
"aspnetCoreRuntimeVersions": "latest, lts",
}
}
```
## OS Support
This Feature should work on recent versions of Debian/Ubuntu-based distributions with the `apt` package manager installed.
`bash` is required to execute the `install.sh` script.
---

View file

@ -1,35 +1,44 @@
{
"id": "dotnet",
"version": "1.1.1",
"version": "2.0.2",
"name": "Dotnet CLI",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/dotnet",
"description": "Installs the .NET CLI. Provides option of installing sdk or runtime, and option of versions to install. Uses latest version of .NET sdk as defaults to install.",
"description": "This Feature installs the latest .NET SDK, which includes the .NET CLI and the shared runtime. Options are provided to choose a different version or additional versions.",
"options": {
"version": {
"type": "string",
"proposals": [
"latest",
"7",
"6",
"3.1"
"lts",
"none",
"8.0",
"7.0",
"6.0"
],
"default": "latest",
"description": "Select or enter a dotnet CLI version. (Available versions may vary by Linux distribution.)"
"description": "Select or enter a .NET SDK version. Use 'latest' for the latest version, 'lts' for the latest LTS version, 'X.Y' or 'X.Y.Z' for a specific version."
},
"runtimeOnly": {
"type": "boolean",
"default": false,
"description": "Install just the dotnet runtime if true, and sdk if false."
"additionalVersions": {
"type": "string",
"default": "",
"description": "Enter additional .NET SDK versions, separated by commas. Use 'latest' for the latest version, 'lts' for the latest LTS version, 'X.Y' or 'X.Y.Z' for a specific version."
},
"installUsingApt": {
"type": "boolean",
"default": "true",
"description": "If true, it installs using apt instead of the release URL"
"dotnetRuntimeVersions": {
"type": "string",
"default": "",
"description": "Enter additional .NET runtime versions, separated by commas. Use 'latest' for the latest version, 'lts' for the latest LTS version, 'X.Y' or 'X.Y.Z' for a specific version."
},
"aspNetCoreRuntimeVersions": {
"type": "string",
"default": "",
"description": "Enter additional ASP.NET Core runtime versions, separated by commas. Use 'latest' for the latest version, 'lts' for the latest LTS version, 'X.Y' or 'X.Y.Z' for a specific version."
}
},
"containerEnv": {
"DOTNET_ROOT": "/usr/local/dotnet/current",
"PATH": "/usr/local/dotnet/current:${PATH}"
"DOTNET_ROOT": "/usr/share/dotnet",
"PATH": "$PATH:$DOTNET_ROOT:~/.dotnet/tools",
"DOTNET_RUNNING_IN_CONTAINER": "true",
"DOTNET_USE_POLLING_FILE_WATCHER": "true"
},
"customizations": {
"vscode": {

506
src/dotnet/install.sh Executable file → Normal file
View file

@ -4,37 +4,21 @@
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
#-------------------------------------------------------------------------------------------------------------
#
# Docs: https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/docs/dotnet.md
# Maintainer: The VS Code and Codespaces Teams
DOTNET_VERSION=${VERSION:-"latest"}
DOTNET_RUNTIME_ONLY=${RUNTIMEONLY:-"false"}
OVERRIDE_DEFAULT_VERSION=${OVERRIDEDEFAULTVERSION:-"true"}
INSTALL_USING_APT=${INSTALLUSINGAPT:-"true"}
DOTNET_LATEST="7"
DOTNET_LTS="6"
USERNAME="${USERNAME:-"${_REMOTE_USER:-"automatic"}"}"
UPDATE_RC=${UPDATE_RC:-"true"}
TARGET_DOTNET_ROOT=${TARGET_DOTNET_ROOT:-"/usr/local/dotnet"}
ACCESS_GROUP=${ACCESS_GROUP:-"dotnet"}
MICROSOFT_GPG_KEYS_URI="https://packages.microsoft.com/keys/microsoft.asc"
DOTNET_ARCHIVE_ARCHITECTURES="amd64"
DOTNET_ARCHIVE_VERSION_CODENAMES="buster bullseye bionic focal hirsute jammy"
# Feed URI sourced from the official dotnet-install.sh
# https://github.com/dotnet/install-scripts/blob/1b98b94a6f6d81cc4845eb88e0195fac67caa0a6/src/dotnet-install.sh#L1342-L1343
DOTNET_CDN_FEED_URI="https://dotnetcli.azureedge.net"
# Ubuntu 22.04 and on do not ship with libssl1.1, which is required for versions of .NET < 6.0
DOTNET_VERSION_CODENAMES_REQUIRE_OLDER_LIBSSL_1="buster bullseye bionic focal hirsute"
# Comma-separated list of dotnet versions to be installed
# alongside DOTNET_VERSION, but not set as default.
ADDITIONAL_VERSIONS=${ADDITIONALVERSIONS:-""}
# Docs: https://github.com/devcontainers/features/tree/main/src/dotnet
# Maintainer: The Dev Container spec maintainers
DOTNET_VERSION="${VERSION:-"latest"}"
ADDITIONAL_VERSIONS="${ADDITIONALVERSIONS}"
DOTNET_RUNTIME_VERSIONS="${DOTNETRUNTIMEVERSIONS}"
ASPNETCORE_RUNTIME_VERSIONS="${ASPNETCORERUNTIMEVERSIONS}"
set -e
# Import trim_whitespace and split_csv
source "scripts/string-helpers.sh"
# Import install_sdk and install_runtime
source "scripts/dotnet-helpers.sh"
# Clean up
rm -rf /var/lib/apt/lists/*
@ -43,72 +27,14 @@ err() {
echo "(!) $*" >&2
}
# Ensure the appropriate root user is running the script.
if [ "$(id -u)" -ne 0 ]; then
err 'Script must be run as root. Use sudo, su, or add "USER root" to your Dockerfile before running this script.'
exit 1
fi
# Ensure that login shells get the correct path if the user updated the PATH using ENV.
rm -f /etc/profile.d/00-restore-env.sh
echo "export PATH=${PATH//$(sh -lc 'echo $PATH')/\$PATH}" > /etc/profile.d/00-restore-env.sh
chmod +x /etc/profile.d/00-restore-env.sh
# 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
###################
# Helper Functions
###################
# Cleanup temporary directory and associated files when exiting the script.
cleanup() {
EXIT_CODE=$?
set +e
if [[ -n "${TMP_DIR}" ]]; then
echo "Executing cleanup of tmp files"
rm -Rf "${TMP_DIR}"
fi
exit $EXIT_CODE
}
trap cleanup EXIT
# Add dotnet directory to PATH in bashrc/zshrc files if OVERRIDE_DEFAULT_VERSION=true.
updaterc() {
if [ "${UPDATE_RC}" = "true" ]; then
echo "Updating /etc/bash.bashrc and /etc/zsh/zshrc..."
if [[ "$(cat /etc/bash.bashrc)" != *"$1"* ]]; then
echo -e "$1" >> /etc/bash.bashrc
fi
if [ -f "/etc/zsh/zshrc" ] && [[ "$(cat /etc/zsh/zshrc)" != *"$1"* ]]; then
echo -e "$1" >> /etc/zsh/zshrc
fi
fi
}
apt_get_update()
{
apt_get_update() {
if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then
echo "Running apt-get update..."
apt-get update -y
fi
}
# Check if packages are installed and installs them if not.
# Checks if packages are installed and installs them if not
check_packages() {
if ! dpkg -s "$@" > /dev/null 2>&1; then
apt_get_update
@ -116,361 +42,77 @@ check_packages() {
fi
}
# Get appropriate architecture name for .NET binaries for the target OS
get_architecture_name_for_target_os() {
local architecture
architecture="$(uname -m)"
case $architecture in
x86_64) architecture="x64";;
aarch64 | armv8*) architecture="arm64";;
*) err "Architecture ${architecture} unsupported"; exit 1 ;;
esac
echo "${architecture}"
}
# Soft version matching that resolves a version for a given package in the *current apt-cache*
# Return value is stored in first argument (the unprocessed version)
apt_cache_package_and_version_soft_match() {
# Version
local version_variable_name="$1"
local requested_version=${!version_variable_name}
# Package Name
local package_variable_name="$2"
local partial_package_name=${!package_variable_name}
local package_name
# Exit on no match?
local exit_on_no_match="${3:-true}"
local major_minor_version
# Ensure we've exported useful variables
. /etc/os-release
local architecture="$(dpkg --print-architecture)"
major_minor_version="$(echo "${requested_version}" | cut -d "." --field=1,2)"
package_name="$(apt-cache search "${partial_package_name}-[0-9].[0-9]" | awk -F" - " '{print $1}' | grep -m 1 "${partial_package_name}-${major_minor_version}")"
dot_escaped="${requested_version//./\\.}"
dot_plus_escaped="${dot_escaped//+/\\+}"
# Regex needs to handle debian package version number format: https://www.systutorials.com/docs/linux/man/5-deb-version/
version_regex="^(.+:)?${dot_plus_escaped}([\\.\\+ ~:-]|$)"
set +e # Don't exit if finding version fails - handle gracefully
fuzzy_version="$(apt-cache madison ${package_name} | awk -F"|" '{print $2}' | sed -e 's/^[ \t]*//' | grep -E -m 1 "${version_regex}")"
set -e
if [ -z "${fuzzy_version}" ]; then
echo "(!) No full or partial for package \"${partial_package_name}\" (resolved: \"${package_name}\") match found in apt-cache for \"${requested_version}\" on OS ${ID} ${VERSION_CODENAME} (${architecture})."
if $exit_on_no_match; then
echo "Available versions:"
apt-cache madison ${package_name} | awk -F"|" '{print $2}' | grep -oP '^(.+:)?\K.+'
exit 1 # Fail entire script
else
echo "Continuing to fallback method if available"
return 1;
fi
fi
# Globally assign fuzzy_version to this value
# Use this value as the return value of this function
declare -g ${version_variable_name}="=${fuzzy_version}"
echo "${version_variable_name} ${!version_variable_name}"
# Globally assign package to this value
# Use this value as the return value of this function
declare -g ${package_variable_name}="${package_name}"
echo "${package_variable_name} ${!package_variable_name}"
}
# Install .NET CLI using apt-get package installer
install_using_apt() {
local sdk_or_runtime="$1"
local target_dotnet_version="$2"
local use_msft_repo="$3"
echo "🚀 Starting install_using_apt ('${sdk_or_runtime}' at version '${target_dotnet_version}' from msft repo '${use_msft_repo}')..."
if [ "${use_msft_repo}" = "true" ]; then
# Install dependencies
check_packages apt-transport-https curl ca-certificates gnupg2 dirmngr
# Import key safely and import Microsoft apt repo
curl -sSL ${MICROSOFT_GPG_KEYS_URI} | gpg --dearmor > /usr/share/keyrings/microsoft-archive-keyring.gpg
echo "deb [arch=${architecture} signed-by=/usr/share/keyrings/microsoft-archive-keyring.gpg] https://packages.microsoft.com/repos/microsoft-${ID}-${VERSION_CODENAME}-prod ${VERSION_CODENAME} main" > /etc/apt/sources.list.d/microsoft.list
apt-get update -y
fi
# .NET 7 is not a LTS version, so handle latest and LTS versions differently
export APT_DOTNET_VERSION="$target_dotnet_version"
if [ "${APT_DOTNET_VERSION}" = "latest" ]; then
APT_DOTNET_VERSION="${DOTNET_LATEST}.0"
elif [ "${APT_DOTNET_VERSION}" = "lts" ]; then
APT_DOTNET_VERSION="${DOTNET_LTS}.0"
fi
# Sets target_dotnet_version and dotnet_package if matches found.
local base_dotnet_package="dotnet-${sdk_or_runtime}"
export DOTNET_PACKAGE="${base_dotnet_package}"
apt_cache_package_and_version_soft_match APT_DOTNET_VERSION DOTNET_PACKAGE false
if [ "$?" != 0 ] || [ ${DOTNET_PACKAGE} == "${base_dotnet_package}" ]; then
echo "Failed to find requested version."
return 1
fi
if type dotnet > /dev/null 2>&1 && [[ "$(dotnet --version)" == *"${APT_DOTNET_VERSION}"* ]] ; then
echo "dotnet version ${APT_DOTNET_VERSION} is already installed"
return 1
fi
echo "Installing '${DOTNET_PACKAGE}${APT_DOTNET_VERSION}'..."
apt-get install -yq ${DOTNET_PACKAGE}${APT_DOTNET_VERSION}
if [ "$?" != 0 ]; then
echo "Failed to complete apt install of ${DOTNET_PACKAGE}${TARGET_DOTNET_VERSION}"
return 1
fi
# Add symlink for current
CURRENT_DIR="${TARGET_DOTNET_ROOT}/current"
if [[ -d "${CURRENT_DIR}" ]]; then
rm -rf "${CURRENT_DIR}"
fi
mkdir -p "${TARGET_DOTNET_ROOT}"
local dotnet_installed_version="$(dotnet --version)"
# See if its the distro version
if [[ "$(dotnet --info)" == *"Base Path: /usr/lib/dotnet/dotnet${dotnet_installed_version:0:1}-${dotnet_installed_version}"* ]]; then
ln -s "/usr/lib/dotnet/dotnet${dotnet_installed_version:0:1}" "${CURRENT_DIR}"
else
# Location used by MS repo versions
ln -s "/usr/share/dotnet" "${CURRENT_DIR}"
fi
}
# Find and extract .NET binary download details based on user-requested version
# args:
# sdk_or_runtime $1
# dotnet_version_to_download $2
# exports:
# DOTNET_DOWNLOAD_URL
# DOTNET_DOWNLOAD_HASH
# DOTNET_DOWNLOAD_NAME
get_full_version_details() {
local sdk_or_runtime="$1"
local architecture
local dotnet_channel_version
local dotnet_releases_url
local dotnet_releases_json
local dotnet_latest_version
local dotnet_download_details
export DOTNET_DOWNLOAD_VERSION="$2"
export DOTNET_DOWNLOAD_URL
export DOTNET_DOWNLOAD_HASH
export DOTNET_DOWNLOAD_NAME
# Set architecture variable to current user's architecture (x64 or ARM64).
architecture="$(get_architecture_name_for_target_os)"
# Set VERSION to empty string to ensure jq includes all .NET versions in reverse sort below
if [ "${DOTNET_DOWNLOAD_VERSION}" = "latest" ]; then
DOTNET_DOWNLOAD_VERSION=""
fi
dotnet_patchless_version="$(echo "${DOTNET_DOWNLOAD_VERSION}" | cut -d "." --field=1,2)"
set +e
dotnet_channel_version="$(curl -s "${DOTNET_CDN_FEED_URI}/dotnet/release-metadata/releases-index.json" | jq -r --arg channel_version "${dotnet_patchless_version}" '[."releases-index"[]] | sort_by(."channel-version") | reverse | map( select(."channel-version" | startswith($channel_version))) | first | ."channel-version"')"
set -e
# Construct the releases URL using the official channel-version if one was found. Otherwise make a best-effort using the user input.
if [ -n "${dotnet_channel_version}" ] && [ "${dotnet_channel_version}" != "null" ]; then
dotnet_releases_url="${DOTNET_CDN_FEED_URI}/dotnet/release-metadata/${dotnet_channel_version}/releases.json"
else
dotnet_releases_url="${DOTNET_CDN_FEED_URI}/dotnet/release-metadata/${dotnet_patchless_version}/releases.json"
fi
set +e
dotnet_releases_json="$(curl -s "${dotnet_releases_url}")"
set -e
if [ -n "${dotnet_releases_json}" ] && [[ ! "${dotnet_releases_json}" = *"Error"* ]]; then
dotnet_latest_version="$(echo "${dotnet_releases_json}" | jq -r --arg sdk_or_runtime "${sdk_or_runtime}" '."latest-\($sdk_or_runtime)"')"
# If user-specified version has 2 or more dots, use it as is. Otherwise use latest version.
if [ "$(echo "${DOTNET_DOWNLOAD_VERSION}" | grep -o "\." | wc -l)" -lt "2" ]; then
DOTNET_DOWNLOAD_VERSION="${dotnet_latest_version}"
fi
dotnet_download_details="$(echo "${dotnet_releases_json}" | jq -r --arg sdk_or_runtime "${sdk_or_runtime}" --arg dotnet_version "${DOTNET_DOWNLOAD_VERSION}" --arg arch "${architecture}" '.releases[]."\($sdk_or_runtime)" | select(.version==$dotnet_version) | .files[] | select(.name=="dotnet-\($sdk_or_runtime)-linux-\($arch).tar.gz")')"
if [ -n "${dotnet_download_details}" ]; then
echo "Found .NET binary version ${DOTNET_DOWNLOAD_VERSION}"
DOTNET_DOWNLOAD_URL="$(echo "${dotnet_download_details}" | jq -r '.url')"
DOTNET_DOWNLOAD_HASH="$(echo "${dotnet_download_details}" | jq -r '.hash')"
DOTNET_DOWNLOAD_NAME="$(echo "${dotnet_download_details}" | jq -r '.name')"
else
err "Unable to find .NET binary for version ${DOTNET_DOWNLOAD_VERSION}"
exit 1
fi
else
err "Unable to find .NET release details for version ${DOTNET_DOWNLOAD_VERSION} at ${dotnet_releases_url}"
exit 1
fi
}
# Install .NET CLI using the .NET releases url
install_using_dotnet_releases_url() {
local sdk_or_runtime="$1"
local version="$2"
echo "🚀 Starting install_using_dotnet_releases_url (${sdk_or_runtime} version ${version})..."
# Check listed package dependecies and install them if they are not already installed.
# NOTE: icu-devtools is a small package with similar dependecies to .NET.
# It will install the appropriate dependencies based on the OS:
# - libgcc-s1 OR libgcc1 depending on OS
# - the latest libicuXX depending on OS (eg libicu57 for stretch)
# - also installs libc6 and libstdc++6 which are required by .NET
check_packages curl ca-certificates tar jq icu-devtools libgssapi-krb5-2 zlib1g
# Starting with Ubuntu 22.04 (jammy), libssl1.1 does not ship with the OS anymore.
if [[ "${DOTNET_VERSION_CODENAMES_REQUIRE_OLDER_LIBSSL_1}" = *"${VERSION_CODENAME}"* ]]; then
check_packages libssl1.1
else
check_packages libssl3
fi
get_full_version_details "${sdk_or_runtime}" "${version}"
DOTNET_INSTALL_PATH="${TARGET_DOTNET_ROOT}/${DOTNET_DOWNLOAD_VERSION}"
if [ -d "${DOTNET_INSTALL_PATH}" ]; then
echo "(!) Dotnet version ${DOTNET_DOWNLOAD_VERSION} already exists."
exit 1
fi
# exports DOTNET_DOWNLOAD_URL, DOTNET_DOWNLOAD_HASH, DOTNET_DOWNLOAD_NAME
echo "DOWNLOAD LINK: ${DOTNET_DOWNLOAD_URL}"
# Setup the access group and add the user to it.
umask 0002
if ! cat /etc/group | grep -e "^${ACCESS_GROUP}:" > /dev/null 2>&1; then
groupadd -r "${ACCESS_GROUP}"
fi
usermod -a -G "${ACCESS_GROUP}" "${USERNAME}"
# Download the .NET binaries.
echo "DOWNLOADING BINARY..."
TMP_DIR="/tmp/dotnetinstall"
mkdir -p "${TMP_DIR}"
curl -sSL "${DOTNET_DOWNLOAD_URL}" -o "${TMP_DIR}/${DOTNET_DOWNLOAD_NAME}"
# Get checksum from .NET CLI blob storage using the runtime version and
# run validation (sha512sum) of checksum against the expected checksum hash.
echo "VERIFY CHECKSUM"
cd "${TMP_DIR}"
echo "${DOTNET_DOWNLOAD_HASH} *${DOTNET_DOWNLOAD_NAME}" | sha512sum -c -
# Extract binaries and add to path.
mkdir -p "${DOTNET_INSTALL_PATH}"
echo "Extract Binary to ${DOTNET_INSTALL_PATH}"
tar -xzf "${TMP_DIR}/${DOTNET_DOWNLOAD_NAME}" -C "${DOTNET_INSTALL_PATH}" --strip-components=1
CURRENT_DIR="${TARGET_DOTNET_ROOT}/current"
if [[ ! -d "${CURRENT_DIR}" ]]; then
ln -s "${DOTNET_INSTALL_PATH}" "${CURRENT_DIR}"
fi
# Give write permissions to the user.
chown -R "${USERNAME}:${USERNAME}" "${CURRENT_DIR}"
chmod g+r+w+s "${CURRENT_DIR}"
chmod -R g+r+w "${CURRENT_DIR}"
if [[ "${OVERRIDE_DEFAULT_VERSION}" = "true" ]]; then
if [[ $(ls -l ${CURRENT_DIR}) != *"-> ${DOTNET_INSTALL_PATH}"* ]] ; then
rm "${CURRENT_DIR}"
ln -s "${DOTNET_INSTALL_PATH}" "${CURRENT_DIR}"
fi
fi
updaterc "if [[ \"\${PATH}\" != *\"${CURRENT_DIR}\"* ]]; then export PATH=${CURRENT_DIR}:\${PATH}; fi"
}
###########################
# Start .NET installation
###########################
export DEBIAN_FRONTEND=noninteractive
. /etc/os-release
architecture="$(dpkg --print-architecture)"
# Dotnet 3.1 and 5 are not supported on Ubuntu 22.04 (jammy)+,
# due to lack of libssl3.0 support.
# See: https://github.com/microsoft/vscode-dev-containers/issues/1458#issuecomment-1135077775
# NOTE: This will only guard against installation of the dotnet versions we propose via 'features'.
# The user can attempt to install any other version at their own risk.
if [[ "${DOTNET_VERSION}" = "3"* ]] || [[ "${DOTNET_VERSION}" = "5"* ]]; then
if [[ ! "${DOTNET_VERSION_CODENAMES_REQUIRE_OLDER_LIBSSL_1}" = *"${VERSION_CODENAME}"* ]]; then
err "Dotnet ${DOTNET_VERSION} is not supported on Ubuntu ${VERSION_CODENAME} due to a change in the 'libssl' dependency across distributions.\n Please upgrade your version of dotnet, or downgrade your OS version."
exit 1
fi
fi
# Determine if the user wants to download .NET Runtime only, or .NET SDK & Runtime
# and set the appropriate variables.
if [ "${DOTNET_RUNTIME_ONLY}" = "true" ]; then
DOTNET_SDK_OR_RUNTIME="runtime"
elif [ "${DOTNET_RUNTIME_ONLY}" = "false" ]; then
DOTNET_SDK_OR_RUNTIME="sdk"
else
err "Expected true for installing dotnet Runtime only or false for installing SDK and Runtime. Received ${DOTNET_RUNTIME_ONLY}."
if [ "$(id -u)" -ne 0 ]; then
err 'Script must be run as root. Use sudo, su, or add "USER root" to your Dockerfile before running this script.'
exit 1
fi
# Install the .NET CLI
echo "(*) Installing .NET CLI..."
# For our own convenience, combine DOTNET_VERSION and ADDITIONAL_VERSIONS into a single 'versions' array
versions=()
CHANGE_OWNERSHIP="false"
if [[ "${DOTNET_ARCHIVE_ARCHITECTURES}" = *"${architecture}"* ]] && [[ "${DOTNET_ARCHIVE_VERSION_CODENAMES}" = *"${VERSION_CODENAME}"* ]] && [[ "${INSTALL_USING_APT}" = "true" ]]; then
echo "Detected ${VERSION_CODENAME} on ${architecture}. Attempting to install dotnet from apt"
install_using_apt "${DOTNET_SDK_OR_RUNTIME}" "${DOTNET_VERSION}" false || install_using_apt "${DOTNET_SDK_OR_RUNTIME}" "${DOTNET_VERSION}" true
if [ "$?" != 0 ]; then
echo "Could not install requested version from apt on current distribution."
exit 1
fi
CHANGE_OWNERSHIP="true"
else
if [[ "${INSTALL_USING_APT}" = "false" ]]; then
echo "Installing dotnet from releases url"
else
echo "Attempting to install dotnet from releases url"
fi
install_using_dotnet_releases_url "${DOTNET_SDK_OR_RUNTIME}" "${DOTNET_VERSION}"
CHANGE_OWNERSHIP="true"
fi
# Additional dotnet versions to be installed but not be set as default.
if [ ! -z "${ADDITIONAL_VERSIONS}" ]; then
OLDIFS=$IFS
IFS=","
read -a additional_versions <<< "$ADDITIONAL_VERSIONS"
for version in "${additional_versions[@]}"; do
OVERRIDE_DEFAULT_VERSION="false"
install_using_dotnet_releases_url "${DOTNET_SDK_OR_RUNTIME}" "${version}"
# The version can be set to 'none' for runtime-only installations, then the array will just remain empty
# Ensure there are no leading or trailing spaces that can break regex pattern matching
if [ "$DOTNET_VERSION" != "none" ]; then
versions+=("$(trim_whitespace "$DOTNET_VERSION")")
for additional_version in $(split_csv "$ADDITIONAL_VERSIONS"); do
versions+=("$additional_version")
done
IFS=$OLDIFS
fi
if [ "${CHANGE_OWNERSHIP}" = "true" ]; then
echo "Changing ownership ("${USERNAME}" <- "${TARGET_DOTNET_ROOT}")"
if ! cat /etc/group | grep -e "^dotnet:" > /dev/null 2>&1; then
groupadd -r dotnet
dotnetRuntimeVersions=()
for dotnetRuntimeVersion in $(split_csv "$DOTNET_RUNTIME_VERSIONS"); do
dotnetRuntimeVersions+=("$dotnetRuntimeVersion")
done
aspNetCoreRuntimeVersions=()
for aspNetCoreRuntimeVersion in $(split_csv "$ASPNETCORE_RUNTIME_VERSIONS"); do
aspNetCoreRuntimeVersions+=("$aspNetCoreRuntimeVersion")
done
# Fail fast in case of bad input to avoid unneccesary work
# v1 of the .NET feature allowed specifying only a major version 'X' like '3'
# v2 removed this ability
# - because install-dotnet.sh does not support it directly
# - because the previous behavior installed an old version like '3.0.103', not the newest version '3.1.426', which was counterintuitive
for version in "${versions[@]}"; do
if [[ "$version" =~ ^[0-9]+$ ]]; then
err "Unsupported .NET SDK version '${version}'. Use 'latest' for the latest version, 'lts' for the latest LTS version, 'X.Y' or 'X.Y.Z' for a specific version."
exit 1
fi
usermod -a -G dotnet "${USERNAME}"
done
chown -H -R "${USERNAME}:dotnet" "${TARGET_DOTNET_ROOT}" # Recursively traverse (-R), also following symbolic links (-H)
chmod -R g+r+w "${TARGET_DOTNET_ROOT}"
find "${TARGET_DOTNET_ROOT}" -type d -print0 | xargs -n 1 -0 chmod g+s
else
echo "Not changing ownership ("${USERNAME}" <- "${TARGET_DOTNET_ROOT}")"
fi
for version in "${dotnetRuntimeVersions[@]}"; do
if [[ "$version" =~ ^[0-9]+$ ]]; then
err "Unsupported .NET Runtime version '${version}'. Use 'latest' for the latest version, 'lts' for the latest LTS version, 'X.Y' or 'X.Y.Z' for a specific version."
exit 1
fi
done
for version in "${aspNetCoreRuntimeVersions[@]}"; do
if [[ "$version" =~ ^[0-9]+$ ]]; then
err "Unsupported ASP.NET Core Runtime version '${version}'. Use 'latest' for the latest version, 'lts' for the latest LTS version, 'X.Y' or 'X.Y.Z' for a specific version."
exit 1
fi
done
# Install .NET versions and dependencies
# icu-devtools includes dependencies for .NET
check_packages wget ca-certificates icu-devtools
for version in "${versions[@]}"; do
install_sdk "$version"
done
for version in "${dotnetRuntimeVersions[@]}"; do
install_runtime "dotnet" "$version"
done
for version in "${aspNetCoreRuntimeVersions[@]}"; do
install_runtime "aspnetcore" "$version"
done
# Clean up
rm -rf /var/lib/apt/lists/*
rm -rf scripts
echo "Done!"

View file

@ -0,0 +1,119 @@
#!/bin/bash
#-------------------------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
#-------------------------------------------------------------------------------------------------------------
#
# Docs: https://github.com/devcontainers/features/tree/main/src/dotnet
# Maintainer: The Dev Container spec maintainers
DOTNET_SCRIPTS=$(dirname "${BASH_SOURCE[0]}")
DOTNET_INSTALL_SCRIPT="$DOTNET_SCRIPTS/vendor/dotnet-install.sh"
DOTNET_INSTALL_DIR='/usr/share/dotnet'
# Prints the latest dotnet version in the specified channel
# Usage: fetch_latest_version_in_channel <channel> [<runtime>]
# Example: fetch_latest_version_in_channel "LTS"
# Example: fetch_latest_version_in_channel "6.0" "dotnet"
# Example: fetch_latest_version_in_channel "6.0" "aspnetcore"
fetch_latest_version_in_channel() {
local channel="$1"
local runtime="$2"
if [ "$runtime" = "dotnet" ]; then
wget -qO- "https://dotnetcli.azureedge.net/dotnet/Runtime/$channel/latest.version"
elif [ "$runtime" = "aspnetcore" ]; then
wget -qO- "https://dotnetcli.azureedge.net/dotnet/aspnetcore/Runtime/$channel/latest.version"
else
wget -qO- "https://dotnetcli.azureedge.net/dotnet/Sdk/$channel/latest.version"
fi
}
# Prints the latest dotnet version
# Usage: fetch_latest_version [<runtime>]
# Example: fetch_latest_version
# Example: fetch_latest_version "dotnet"
# Example: fetch_latest_version "aspnetcore"
fetch_latest_version() {
local runtime="$1"
local sts_version
local lts_version
sts_version=$(fetch_latest_version_in_channel "STS" "$runtime")
lts_version=$(fetch_latest_version_in_channel "LTS" "$runtime")
if [[ "$sts_version" > "$lts_version" ]]; then
echo "$sts_version"
else
echo "$lts_version"
fi
}
# Installs a version of the .NET SDK
# Usage: install_sdk <version>
install_sdk() {
local inputVersion="$1"
local version=""
local channel=""
if [[ "$inputVersion" == "latest" ]]; then
# Fetch the latest version manually, because dotnet-install.sh does not support it directly
version=$(fetch_latest_version)
elif [[ "$inputVersion" == "lts" ]]; then
# When user input is 'lts'
# Then version=latest, channel=LTS
version="latest"
channel="LTS"
elif [[ "$inputVersion" =~ ^[0-9]+\.[0-9]+$ ]]; then
# When user input is form 'A.B' like '3.1'
# Then version=latest, channel=3.1
version="latest"
channel="$inputVersion"
elif [[ "$inputVersion" =~ ^[0-9]+\.[0-9]+\.[0-9]xx$ ]]; then
# When user input is form 'A.B.Cxx' like '6.0.4xx'
# Then version=latest, channel=6.0.4xx
version="latest"
channel="$inputVersion"
else
# Assume version is an exact version string like '6.0.413' or '8.0.100-rc.2.23425.18'
version="$inputVersion"
fi
# Currently this script does not make it possible to qualify the version, 'GA' is always implied
echo "Executing $DOTNET_INSTALL_SCRIPT --version $version --channel $channel --install-dir $DOTNET_INSTALL_DIR --no-path"
"$DOTNET_INSTALL_SCRIPT" \
--version "$version" \
--channel "$channel" \
--install-dir "$DOTNET_INSTALL_DIR" \
--no-path
}
# Installs a version of the .NET Runtime
# Usage: install_runtime <runtime> <version>
install_runtime() {
local runtime="$1"
local inputVersion="$2"
local version=""
local channel=""
if [[ "$inputVersion" == "latest" ]]; then
# Fetch the latest version manually, because dotnet-install.sh does not support it directly
version=$(fetch_latest_version "$runtime")
elif [[ "$inputVersion" == "lts" ]]; then
# When user input is 'lts'
# Then version=latest, channel=LTS
version="latest"
channel="LTS"
elif [[ "$inputVersion" =~ ^[0-9]+\.[0-9]+$ ]]; then
# When user input is form 'A.B' like '3.1'
# Then version=latest, channel=3.1
version="latest"
channel="$inputVersion"
else
# Assume version is an exact version string like '6.0.21' or '8.0.0-preview.7.23375.6'
version="$inputVersion"
fi
echo "Executing $DOTNET_INSTALL_SCRIPT --runtime $runtime --version $version --channel $channel --install-dir $DOTNET_INSTALL_DIR --no-path"
"$DOTNET_INSTALL_SCRIPT" \
--runtime "$runtime" \
--version "$version" \
--channel "$channel" \
--install-dir "$DOTNET_INSTALL_DIR" \
--no-path
}

View file

@ -0,0 +1,16 @@
#!/bin/bash
#-------------------------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
#-------------------------------------------------------------------------------------------------------------
#
# Docs: https://github.com/devcontainers/features/tree/main/src/dotnet
# Maintainer: The Dev Container spec maintainers
#
# Run this script to replace dotnet-install.sh with the latest and greatest available version
#
DOTNET_SCRIPTS=$(dirname "${BASH_SOURCE[0]}")
DOTNET_INSTALL_SCRIPT="$DOTNET_SCRIPTS/vendor/dotnet-install.sh"
wget https://dot.net/v1/dotnet-install.sh -O "$DOTNET_INSTALL_SCRIPT"
chmod +x "$DOTNET_INSTALL_SCRIPT"

View file

@ -0,0 +1,42 @@
#!/bin/bash
#-------------------------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
#-------------------------------------------------------------------------------------------------------------
#
# Docs: https://github.com/devcontainers/features/tree/main/src/dotnet
# Maintainer: The Dev Container spec maintainers
# Removes leading and trailing whitespace from an input string
# Usage: trim_whitespace <text>
trim_whitespace() {
text="$1"
# Remove leading spaces
while [ "${text:0:1}" == " " ]; do
text="${text:1}"
done
# Remove trailing spaces
while [ "${text: -1}" == " " ]; do
text="${text:0:-1}"
done
echo "$text"
}
# Splits comma-separated values into an array while ignoring empty entries
# Usage: split_csv <comma-separated-values>
split_csv() {
local -a values=()
while IFS="," read -ra entries; do
for entry in "${entries[@]}"; do
entry="$(trim_whitespace "$entry")"
if [ -n "$entry" ]; then
values+=("$entry")
fi
done
done <<< "$1"
echo "${values[@]}"
}

27
src/dotnet/scripts/vendor/README.md vendored Normal file
View file

@ -0,0 +1,27 @@
### **IMPORTANT NOTE**
Scripts in this directory are sourced externally and not maintained by the Dev Container spec maintainers. Do not make changes directly as they might be overwritten at any moment.
## dotnet-install.sh
`dotnet-install.sh` is a copy of <https://dot.net/v1/dotnet-install.sh>. ([Script reference](https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-install-script))
Quick options reminder for `dotnet-install.sh`:
- `--version`: `"latest"` (default) or an exact version in the form A.B.C like `"6.0.413"`
- `--channel`: `"LTS"` (default), `"STS"`, a two-part version in the form A.B like `"6.0"` or three-part form A.B.Cxx like `"6.0.1xx"`
- `--quality`: `"daily"`, `"preview"` or `"GA"`
- The channel option is only used when version is 'latest' because an exact version overrides the channel option
- The quality option is only used when channel is 'A.B' or 'A.B.Cxx' because it can't be used with STS or LTS
Examples
```
dotnet-install.sh [--version latest] [--channel LTS]
dotnet-install.sh [--version latest] --channel STS
dotnet-install.sh [--version latest] --channel 6.0 [--quality GA]
dotnet-install.sh [--version latest] --channel 6.0.4xx [--quality GA]
dotnet-install.sh [--version latest] --channel 8.0 --quality preview
dotnet-install.sh [--version latest] --channel 8.0 --quality daily
dotnet-install.sh --version 6.0.413
```

1835
src/dotnet/scripts/vendor/dotnet-install.sh vendored Executable file

File diff suppressed because it is too large Load diff

7
src/git-lfs/NOTES.md Normal file
View file

@ -0,0 +1,7 @@
## OS Support
This Feature should work on recent versions of Debian/Ubuntu-based distributions with the `apt` package manager installed.
`bash` is required to execute the `install.sh` script.

View file

@ -16,9 +16,17 @@ Installs Git Large File Support (Git LFS) along with needed dependencies. Useful
| Options Id | Description | Type | Default Value |
|-----|-----|-----|-----|
| version | Select version of Git LFS to install | string | latest |
| autoPull | Automatically pull LFS files when creating the container. When false, running 'git lfs pull' in the container will have the same effect. | boolean | true |
## OS Support
This Feature should work on recent versions of Debian/Ubuntu-based distributions with the `apt` package manager installed.
`bash` is required to execute the `install.sh` script.
---
_Note: This file was auto-generated from the [devcontainer-feature.json](https://github.com/devcontainers/features/blob/main/src/git-lfs/devcontainer-feature.json). Add additional notes to a `NOTES.md`._

View file

@ -1,20 +1,26 @@
{
"id": "git-lfs",
"version": "1.0.4",
"version": "1.1.1",
"name": "Git Large File Support (LFS)",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/git-lfs",
"description": "Installs Git Large File Support (Git LFS) along with needed dependencies. Useful for base Dockerfiles that often are missing required install dependencies like git and curl.",
"options": {
"version": {
"type": "string",
"enum": [
"proposals": [
"latest",
"none"
],
"default": "latest",
"description": "Select version of Git LFS to install"
},
"autoPull": {
"type": "boolean",
"default": true,
"description": "Automatically pull LFS files when creating the container. When false, running 'git lfs pull' in the container will have the same effect."
}
},
"postCreateCommand": "/usr/local/share/pull-git-lfs-artifacts.sh",
"installsAfter": [
"ghcr.io/devcontainers/features/common-utils"
]

View file

@ -8,12 +8,14 @@
# Maintainer: The VS Code and Codespaces Teams
GIT_LFS_VERSION=${VERSION:-"latest"}
AUTO_PULL=${AUTOPULL:="true"}
GIT_LFS_ARCHIVE_GPG_KEY_URI="https://packagecloud.io/github/git-lfs/gpgkey"
GIT_LFS_ARCHIVE_ARCHITECTURES="amd64 arm64"
GIT_LFS_ARCHIVE_VERSION_CODENAMES="stretch buster bullseye bionic focal jammy"
GIT_LFS_CHECKSUM_GPG_KEYS="0x88ace9b29196305ba9947552f1ba225c0223b187 0x86cd3297749375bcf8206715f54fe648088335a9 0xaa3b3450295830d2de6db90caba67be5a5795889"
GPG_KEY_SERVERS="keyserver hkp://keyserver.ubuntu.com:80
GPG_KEY_SERVERS="keyserver hkp://keyserver.ubuntu.com
keyserver hkp://keyserver.ubuntu.com:80
keyserver hkps://keys.openpgp.org
keyserver hkp://keyserver.pgp.com"
@ -27,21 +29,6 @@ if [ "$(id -u)" -ne 0 ]; then
exit 1
fi
# Get central common setting
get_common_setting() {
if [ "${common_settings_file_loaded}" != "true" ]; then
curl -sfL "https://aka.ms/vscode-dev-containers/script-library/settings.env" 2>/dev/null -o /tmp/vsdc-settings.env || echo "Could not download settings file. Skipping."
common_settings_file_loaded=true
fi
if [ -f "/tmp/vsdc-settings.env" ]; then
local multi_line=""
if [ "$2" = "true" ]; then multi_line="-z"; fi
local result="$(grep ${multi_line} -oP "$1=\"?\K[^\"]+" /tmp/vsdc-settings.env | tr -d '\0')"
if [ ! -z "${result}" ]; then declare -g $1="${result}"; fi
fi
echo "$1=${!1}"
}
# Figure out correct version of a three part version number is not passed
find_version_from_git_tags() {
local variable_name=$1
@ -78,11 +65,9 @@ find_version_from_git_tags() {
# Import the specified key in a variable name passed in as
receive_gpg_keys() {
get_common_setting $1
local keys=${!1}
get_common_setting GPG_KEY_SERVERS true
# Use a temporary locaiton for gpg keys to avoid polluting image
# Use a temporary location for gpg keys to avoid polluting image
export GNUPGHOME="/tmp/tmp-gnupg"
mkdir -p ${GNUPGHOME}
chmod 700 ${GNUPGHOME}
@ -133,7 +118,6 @@ install_using_apt() {
version_suffix=""
fi
# Install
get_common_setting GIT_LFS_ARCHIVE_GPG_KEY_URI
curl -sSL "${GIT_LFS_ARCHIVE_GPG_KEY_URI}" | gpg --dearmor > /usr/share/keyrings/gitlfs-archive-keyring.gpg
echo -e "deb [arch=${architecture} signed-by=/usr/share/keyrings/gitlfs-archive-keyring.gpg] https://packagecloud.io/github/git-lfs/${ID} ${VERSION_CODENAME} main\ndeb-src [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/gitlfs-archive-keyring.gpg] https://packagecloud.io/github/git-lfs/${ID} ${VERSION_CODENAME} main" > /etc/apt/sources.list.d/git-lfs.list
@ -203,6 +187,37 @@ if [ "${use_github}" = "true" ]; then
install_using_github
fi
# --- Generate a 'pull-git-lfs-artifacts.sh' script to be executed by the 'postCreateCommand' lifecycle hook
PULL_GIT_LFS_SCRIPT_PATH="/usr/local/share/pull-git-lfs-artifacts.sh"
tee "$PULL_GIT_LFS_SCRIPT_PATH" > /dev/null \
<< EOF
#!/bin/sh
set -e
AUTO_PULL=${AUTO_PULL}
EOF
tee -a "$PULL_GIT_LFS_SCRIPT_PATH" > /dev/null \
<< 'EOF'
echo "Fetching git lfs artifacts..."
if [ "${AUTO_PULL}" != "true" ]; then
echo "(!) Skipping 'git lfs pull' because 'autoPull' is not set to 'true'"
exit 0
fi
# Check if repo is a git lfs repo.
if ! git lfs ls-files > /dev/null 2>&1; then
echo "(!) Skipping automatic 'git lfs pull' because no git lfs files were detected"
exit 0
fi
git lfs pull
EOF
chmod 755 "$PULL_GIT_LFS_SCRIPT_PATH"
# Clean up
rm -rf /var/lib/apt/lists/*

7
src/git/NOTES.md Normal file
View file

@ -0,0 +1,7 @@
## OS Support
This Feature should work on recent versions of Debian/Ubuntu-based distributions with the `apt` package manager installed.
`bash` is required to execute the `install.sh` script.

View file

@ -20,6 +20,13 @@ Install an up-to-date version of Git, built from source as needed. Useful for wh
## OS Support
This Feature should work on recent versions of Debian/Ubuntu-based distributions with the `apt` package manager installed.
`bash` is required to execute the `install.sh` script.
---
_Note: This file was auto-generated from the [devcontainer-feature.json](https://github.com/devcontainers/features/blob/main/src/git/devcontainer-feature.json). Add additional notes to a `NOTES.md`._

View file

@ -1,6 +1,6 @@
{
"id": "git",
"version": "1.0.5",
"version": "1.1.6",
"name": "Git (from source)",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/git",
"description": "Install an up-to-date version of Git, built from source as needed. Useful for when you want the latest and greatest features. Auto-detects latest stable version and installs needed dependencies.",

View file

@ -11,7 +11,8 @@ GIT_VERSION=${VERSION} # 'system' checks the base image first, else installs 'la
USE_PPA_IF_AVAILABLE=${PPA}
GIT_CORE_PPA_ARCHIVE_GPG_KEY=E1DD270288B4E6030699E45FA1715D88E1DF1F24
GPG_KEY_SERVERS="keyserver hkp://keyserver.ubuntu.com:80
GPG_KEY_SERVERS="keyserver hkp://keyserver.ubuntu.com
keyserver hkp://keyserver.ubuntu.com:80
keyserver hkps://keys.openpgp.org
keyserver hkp://keyserver.pgp.com"
@ -25,33 +26,16 @@ if [ "$(id -u)" -ne 0 ]; then
exit 1
fi
# Get central common setting
get_common_setting() {
if [ "${common_settings_file_loaded}" != "true" ]; then
curl -sfL "https://aka.ms/vscode-dev-containers/script-library/settings.env" 2>/dev/null -o /tmp/vsdc-settings.env || echo "Could not download settings file. Skipping."
common_settings_file_loaded=true
fi
if [ -f "/tmp/vsdc-settings.env" ]; then
local multi_line=""
if [ "$2" = "true" ]; then multi_line="-z"; fi
local result="$(grep ${multi_line} -oP "$1=\"?\K[^\"]+" /tmp/vsdc-settings.env | tr -d '\0')"
if [ ! -z "${result}" ]; then declare -g $1="${result}"; fi
fi
echo "$1=${!1}"
}
# Import the specified key in a variable name passed in as
receive_gpg_keys() {
get_common_setting $1
local keys=${!1}
get_common_setting GPG_KEY_SERVERS true
local keyring_args=""
if [ ! -z "$2" ]; then
mkdir -p "$(dirname \"$2\")"
keyring_args="--no-default-keyring --keyring $2"
fi
# Use a temporary locaiton for gpg keys to avoid polluting image
# Use a temporary location for gpg keys to avoid polluting image
export GNUPGHOME="/tmp/tmp-gnupg"
mkdir -p ${GNUPGHOME}
chmod 700 ${GNUPGHOME}
@ -147,11 +131,21 @@ if [ "$(echo "${GIT_VERSION}" | grep -o '\.' | wc -l)" != "2" ]; then
fi
fi
check_packages libpcre2-dev
if [ "${VERSION_CODENAME}" = "focal" ] || [ "${VERSION_CODENAME}" = "bullseye" ]; then
check_packages libpcre2-posix2
elif [ "${VERSION_CODENAME}" = "bionic" ] || [ "${VERSION_CODENAME}" = "buster" ]; then
check_packages libpcre2-posix0
else
check_packages libpcre2-posix3
fi
echo "Downloading source for ${GIT_VERSION}..."
curl -sL https://github.com/git/git/archive/v${GIT_VERSION}.tar.gz | tar -xzC /tmp 2>&1
echo "Building..."
cd /tmp/git-${GIT_VERSION}
make -s prefix=/usr/local all && make -s prefix=/usr/local install 2>&1
make -s USE_LIBPCRE=YesPlease prefix=/usr/local sysconfdir=/etc all && make -s USE_LIBPCRE=YesPlease prefix=/usr/local sysconfdir=/etc install 2>&1
rm -rf /tmp/git-${GIT_VERSION}
rm -rf /var/lib/apt/lists/*
echo "Done!"

7
src/github-cli/NOTES.md Normal file
View file

@ -0,0 +1,7 @@
## OS Support
This Feature should work on recent versions of Debian/Ubuntu-based distributions with the `apt` package manager installed.
`bash` is required to execute the `install.sh` script.

View file

@ -20,6 +20,13 @@ Installs the GitHub CLI. Auto-detects latest version and installs needed depende
## OS Support
This Feature should work on recent versions of Debian/Ubuntu-based distributions with the `apt` package manager installed.
`bash` is required to execute the `install.sh` script.
---
_Note: This file was auto-generated from the [devcontainer-feature.json](https://github.com/devcontainers/features/blob/main/src/github-cli/devcontainer-feature.json). Add additional notes to a `NOTES.md`._

View file

@ -1,6 +1,6 @@
{
"id": "github-cli",
"version": "1.0.6",
"version": "1.0.11",
"name": "GitHub CLI",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/github-cli",
"description": "Installs the GitHub CLI. Auto-detects latest version and installs needed dependencies.",
@ -20,7 +20,8 @@
}
},
"installsAfter": [
"ghcr.io/devcontainers/features/common-utils"
"ghcr.io/devcontainers/features/common-utils",
"ghcr.io/devcontainers/features/git"
]
}

View file

@ -11,7 +11,8 @@ CLI_VERSION=${VERSION:-"latest"}
INSTALL_DIRECTLY_FROM_GITHUB_RELEASE=${INSTALLDIRECTLYFROMGITHUBRELEASE:-"true"}
GITHUB_CLI_ARCHIVE_GPG_KEY=23F3D4EA75716059
GPG_KEY_SERVERS="keyserver hkp://keyserver.ubuntu.com:80
GPG_KEY_SERVERS="keyserver hkp://keyserver.ubuntu.com
keyserver hkp://keyserver.ubuntu.com:80
keyserver hkps://keys.openpgp.org
keyserver hkp://keyserver.pgp.com"
@ -25,64 +26,16 @@ if [ "$(id -u)" -ne 0 ]; then
exit 1
fi
# Get central common setting
get_common_setting() {
if [ "${common_settings_file_loaded}" != "true" ]; then
curl -sfL "https://aka.ms/vscode-dev-containers/script-library/settings.env" 2>/dev/null -o /tmp/vsdc-settings.env || echo "Could not download settings file. Skipping."
common_settings_file_loaded=true
fi
if [ -f "/tmp/vsdc-settings.env" ]; then
local multi_line=""
if [ "$2" = "true" ]; then multi_line="-z"; fi
local result="$(grep ${multi_line} -oP "$1=\"?\K[^\"]+" /tmp/vsdc-settings.env | tr -d '\0')"
if [ ! -z "${result}" ]; then declare -g $1="${result}"; fi
fi
echo "$1=${!1}"
}
# Import the specified key in a variable name passed in as
receive_gpg_keys() {
get_common_setting $1
local keys=${!1}
get_common_setting GPG_KEY_SERVERS true
# Use a temporary locaiton for gpg keys to avoid polluting image
export GNUPGHOME="/tmp/tmp-gnupg"
mkdir -p ${GNUPGHOME}
chmod 700 ${GNUPGHOME}
echo -e "disable-ipv6\n${GPG_KEY_SERVERS}" > ${GNUPGHOME}/dirmngr.conf
# GPG key download sometimes fails for some reason and retrying fixes it.
local retry_count=0
local gpg_ok="false"
set +e
until [ "${gpg_ok}" = "true" ] || [ "${retry_count}" -eq "5" ];
do
echo "(*) Downloading GPG key..."
( echo "${keys}" | xargs -n 1 gpg --recv-keys) 2>&1 && gpg_ok="true"
if [ "${gpg_ok}" != "true" ]; then
echo "(*) Failed getting key, retring in 10s..."
(( retry_count++ ))
sleep 10s
fi
done
set -e
if [ "${gpg_ok}" = "false" ]; then
echo "(!) Failed to get gpg key."
exit 1
fi
}
# Import the specified key in a variable name passed in as
receive_gpg_keys() {
get_common_setting $1
local keys=${!1}
get_common_setting GPG_KEY_SERVERS true
local keyring_args=""
if [ ! -z "$2" ]; then
keyring_args="--no-default-keyring --keyring $2"
fi
# Use a temporary locaiton for gpg keys to avoid polluting image
# Use a temporary location for gpg keys to avoid polluting image
export GNUPGHOME="/tmp/tmp-gnupg"
mkdir -p ${GNUPGHOME}
chmod 700 ${GNUPGHOME}
@ -158,6 +111,46 @@ find_version_from_git_tags() {
echo "${variable_name}=${!variable_name}"
}
# Use semver logic to decrement a version number then look for the closest match
find_prev_version_from_git_tags() {
local variable_name=$1
local current_version=${!variable_name}
local repository=$2
# Normally a "v" is used before the version number, but support alternate cases
local prefix=${3:-"tags/v"}
# Some repositories use "_" instead of "." for version number part separation, support that
local separator=${4:-"."}
# Some tools release versions that omit the last digit (e.g. go)
local last_part_optional=${5:-"false"}
# Some repositories may have tags that include a suffix (e.g. actions/node-versions)
local version_suffix_regex=$6
# Try one break fix version number less if we get a failure. Use "set +e" since "set -e" can cause failures in valid scenarios.
set +e
major="$(echo "${current_version}" | grep -oE '^[0-9]+' || echo '')"
minor="$(echo "${current_version}" | grep -oP '^[0-9]+\.\K[0-9]+' || echo '')"
breakfix="$(echo "${current_version}" | grep -oP '^[0-9]+\.[0-9]+\.\K[0-9]+' 2>/dev/null || echo '')"
if [ "${minor}" = "0" ] && [ "${breakfix}" = "0" ]; then
((major=major-1))
declare -g ${variable_name}="${major}"
# Look for latest version from previous major release
find_version_from_git_tags "${variable_name}" "${repository}" "${prefix}" "${separator}" "${last_part_optional}"
# Handle situations like Go's odd version pattern where "0" releases omit the last part
elif [ "${breakfix}" = "" ] || [ "${breakfix}" = "0" ]; then
((minor=minor-1))
declare -g ${variable_name}="${major}.${minor}"
# Look for latest version from previous minor release
find_version_from_git_tags "${variable_name}" "${repository}" "${prefix}" "${separator}" "${last_part_optional}"
else
((breakfix=breakfix-1))
if [ "${breakfix}" = "0" ] && [ "${last_part_optional}" = "true" ]; then
declare -g ${variable_name}="${major}.${minor}"
else
declare -g ${variable_name}="${major}.${minor}.${breakfix}"
fi
fi
set -e
}
# Fall back on direct download if no apt package exists
# Fetches .deb file to be installed with dpkg
@ -171,6 +164,15 @@ install_deb_using_github() {
mkdir -p /tmp/ghcli
pushd /tmp/ghcli
wget https://github.com/cli/cli/releases/download/v${CLI_VERSION}/${cli_filename}
exit_code=$?
set -e
if [ "$exit_code" != "0" ]; then
# Handle situation where git tags are ahead of what was is available to actually download
echo "(!) github-cli version ${CLI_VERSION} failed to download. Attempting to fall back one version to retry..."
find_prev_version_from_git_tags CLI_VERSION https://github.com/cli/cli
wget https://github.com/cli/cli/releases/download/v${CLI_VERSION}/${cli_filename}
fi
dpkg -i /tmp/ghcli/${cli_filename}
popd
rm -rf /tmp/ghcli

7
src/go/NOTES.md Normal file
View file

@ -0,0 +1,7 @@
## OS Support
This Feature should work on recent versions of Debian/Ubuntu-based distributions with the `apt` package manager installed.
`bash` is required to execute the `install.sh` script.

View file

@ -18,6 +18,19 @@ Installs Go and common Go utilities. Auto-detects latest version and installs ne
| version | Select or enter a Go version to install | string | latest |
| golangciLintVersion | Version of golangci-lint to install | string | latest |
## Customizations
### VS Code Extensions
- `golang.Go`
## OS Support
This Feature should work on recent versions of Debian/Ubuntu-based distributions with the `apt` package manager installed.
`bash` is required to execute the `install.sh` script.
---

View file

@ -1,6 +1,6 @@
{
"id": "go",
"version": "1.1.0",
"version": "1.2.2",
"name": "Go",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/go",
"description": "Installs Go and common Go utilities. Auto-detects latest version and installs needed dependencies.",
@ -10,8 +10,8 @@
"proposals": [
"latest",
"none",
"1.19",
"1.18"
"1.21",
"1.20"
],
"default": "latest",
"description": "Select or enter a Go version to install"

View file

@ -7,13 +7,13 @@
# Docs: https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/docs/go.md
# Maintainer: The VS Code and Codespaces Teams
TARGET_GO_VERSION=${VERSION:-"latest"}
GOLANGCILINT_VERSION=${GOLANGCILINTVERSION:-"latest"}
TARGET_GO_VERSION="${VERSION:-"latest"}"
GOLANGCILINT_VERSION="${GOLANGCILINTVERSION:-"latest"}"
TARGET_GOROOT=${TARGET_GOROOT:-"/usr/local/go"}
TARGET_GOPATH=${TARGET_GOPATH:-"/go"}
USERNAME=${USERNAME:-"automatic"}
INSTALL_GO_TOOLS=${INSTALL_GO_TOOLS:-"true"}
TARGET_GOROOT="${TARGET_GOROOT:-"/usr/local/go"}"
TARGET_GOPATH="${TARGET_GOPATH:-"/go"}"
USERNAME="${USERNAME:-"${_REMOTE_USER:-"automatic"}"}"
INSTALL_GO_TOOLS="${INSTALL_GO_TOOLS:-"true"}"
# https://www.google.com/linuxrepositories/
GO_GPG_KEY_URI="https://dl.google.com/linux/linux_signing_key.pub"
@ -84,21 +84,6 @@ find_version_from_git_tags() {
echo "${variable_name}=${!variable_name}"
}
# Get central common setting
get_common_setting() {
if [ "${common_settings_file_loaded}" != "true" ]; then
curl -sfL "https://aka.ms/vscode-dev-containers/script-library/settings.env" 2>/dev/null -o /tmp/vsdc-settings.env || echo "Could not download settings file. Skipping."
common_settings_file_loaded=true
fi
if [ -f "/tmp/vsdc-settings.env" ]; then
local multi_line=""
if [ "$2" = "true" ]; then multi_line="-z"; fi
local result="$(grep ${multi_line} -oP "$1=\"?\K[^\"]+" /tmp/vsdc-settings.env | tr -d '\0')"
if [ ! -z "${result}" ]; then declare -g $1="${result}"; fi
fi
echo "$1=${!1}"
}
apt_get_update()
{
if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then
@ -142,12 +127,12 @@ if ! cat /etc/group | grep -e "^golang:" > /dev/null 2>&1; then
fi
usermod -a -G golang "${USERNAME}"
mkdir -p "${TARGET_GOROOT}" "${TARGET_GOPATH}"
if [ "${TARGET_GO_VERSION}" != "none" ] && ! type go > /dev/null 2>&1; then
# Use a temporary locaiton for gpg keys to avoid polluting image
if [[ "${TARGET_GO_VERSION}" != "none" ]] && [[ "$(go version)" != *"${TARGET_GO_VERSION}"* ]]; then
# Use a temporary location for gpg keys to avoid polluting image
export GNUPGHOME="/tmp/tmp-gnupg"
mkdir -p ${GNUPGHOME}
chmod 700 ${GNUPGHOME}
get_common_setting GO_GPG_KEY_URI
curl -sSL -o /tmp/tmp-gnupg/golang_key "${GO_GPG_KEY_URI}"
gpg -q --import /tmp/tmp-gnupg/golang_key
echo "Downloading Go ${TARGET_GO_VERSION}..."
@ -186,19 +171,22 @@ if [ "${TARGET_GO_VERSION}" != "none" ] && ! type go > /dev/null 2>&1; then
tar -xzf /tmp/go.tar.gz -C "${TARGET_GOROOT}" --strip-components=1
rm -rf /tmp/go.tar.gz /tmp/go.tar.gz.asc /tmp/tmp-gnupg
else
echo "Go already installed. Skipping."
echo "(!) Go is already installed with version ${TARGET_GO_VERSION}. Skipping."
fi
# Install Go tools that are isImportant && !replacedByGopls based on
# https://github.com/golang/vscode-go/blob/v0.31.1/src/goToolsInformation.ts
# https://github.com/golang/vscode-go/blob/v0.38.0/src/goToolsInformation.ts
GO_TOOLS="\
golang.org/x/tools/gopls@latest \
honnef.co/go/tools/cmd/staticcheck@latest \
golang.org/x/lint/golint@latest \
github.com/mgechev/revive@latest \
github.com/uudashr/gopkgs/v2/cmd/gopkgs@latest \
github.com/ramya-rao-a/go-outline@latest \
github.com/go-delve/delve/cmd/dlv@latest"
github.com/go-delve/delve/cmd/dlv@latest \
github.com/fatih/gomodifytags@latest \
github.com/haya14busa/goplay/cmd/goplay@latest \
github.com/cweill/gotests/gotests@latest \
github.com/josharian/impl@latest"
if [ "${INSTALL_GO_TOOLS}" = "true" ]; then
echo "Installing common Go tools..."
export PATH=${TARGET_GOROOT}/bin:${PATH}
@ -218,8 +206,10 @@ if [ "${INSTALL_GO_TOOLS}" = "true" ]; then
(echo "${GO_TOOLS}" | xargs -n 1 go ${go_install_command} -v )2>&1 | tee -a /usr/local/etc/vscode-dev-containers/go.log
# Move Go tools into path and clean up
if [ -d /tmp/gotools/bin ]; then
mv /tmp/gotools/bin/* ${TARGET_GOPATH}/bin/
rm -rf /tmp/gotools
fi
# Install golangci-lint from precompiled binares
if [ "$GOLANGCILINT_VERSION" = "latest" ] || [ "$GOLANGCILINT_VERSION" = "" ]; then

7
src/hugo/NOTES.md Normal file
View file

@ -0,0 +1,7 @@
## OS Support
This Feature should work on recent versions of Debian/Ubuntu-based distributions with the `apt` package manager installed.
`bash` is required to execute the `install.sh` script.

View file

@ -20,6 +20,13 @@
## OS Support
This Feature should work on recent versions of Debian/Ubuntu-based distributions with the `apt` package manager installed.
`bash` is required to execute the `install.sh` script.
---
_Note: This file was auto-generated from the [devcontainer-feature.json](https://github.com/devcontainers/features/blob/main/src/hugo/devcontainer-feature.json). Add additional notes to a `NOTES.md`._

View file

@ -1,6 +1,6 @@
{
"id": "hugo",
"version": "1.1.0",
"version": "1.1.2",
"name": "Hugo",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/hugo",
"options": {

View file

@ -7,12 +7,12 @@
# Docs: https://github.com/microsoft/vscode-dev-containers/blob/main/script-library/docs/hugo.md
# Maintainer: The VS Code and Codespaces Teams
VERSION=${VERSION:-"latest"}
VERSION="${VERSION:-"latest"}"
USERNAME=${USERNAME:-"automatic"}
UPDATE_RC=${UPDATE_RC:-"true"}
USERNAME="${USERNAME:-"${_REMOTE_USER:-"automatic"}"}"
UPDATE_RC="${UPDATE_RC:-"true"}"
HUGO_DIR=${HUGO_DIR:-"/usr/local/hugo"}
HUGO_DIR="${HUGO_DIR:-"/usr/local/hugo"}"
set -e

View file

@ -1,3 +1,10 @@
## License
For the Java Feature from this repository, see [NOTICE.txt](https://github.com/devcontainers/features/tree/main/src/java/NOTICE.txt) for licensing information on JDK distributions.
## OS Support
This Feature should work on recent versions of Debian/Ubuntu-based distributions with the `apt` package manager installed.
`bash` is required to execute the `install.sh` script.

View file

@ -18,13 +18,30 @@ Installs Java, SDKMAN! (if not installed), and needed dependencies.
| version | Select or enter a Java version to install | string | latest |
| jdkDistro | Select or enter a JDK distribution | string | ms |
| installGradle | Install Gradle, a build automation tool for multi-language software development | boolean | false |
| gradleVersion | Select or enter a Gradle version | string | latest |
| installMaven | Install Maven, a management tool for Java | boolean | false |
| mavenVersion | Select or enter a Maven version | string | latest |
| installAnt | Install Ant, a software tool for automating software build processes | boolean | false |
| antVersion | Select or enter an Ant version | string | latest |
## Customizations
### VS Code Extensions
- `vscjava.vscode-java-pack`
## License
For the Java Feature from this repository, see [NOTICE.txt](https://github.com/devcontainers/features/tree/main/src/java/NOTICE.txt) for licensing information on JDK distributions.
## OS Support
This Feature should work on recent versions of Debian/Ubuntu-based distributions with the `apt` package manager installed.
`bash` is required to execute the `install.sh` script.
---
_Note: This file was auto-generated from the [devcontainer-feature.json](https://github.com/devcontainers/features/blob/main/src/java/devcontainer-feature.json). Add additional notes to a `NOTES.md`._

View file

@ -1,6 +1,6 @@
{
"id": "java",
"version": "1.0.11",
"version": "1.2.2",
"name": "Java (via SDKMAN!)",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/java",
"description": "Installs Java, SDKMAN! (if not installed), and needed dependencies.",
@ -33,13 +33,49 @@
"default": false,
"description": "Install Gradle, a build automation tool for multi-language software development"
},
"gradleVersion": {
"type": "string",
"proposals": [
"latest",
"7.5.1",
"6.9.3",
"5.6.4"
],
"default": "latest",
"description": "Select or enter a Gradle version"
},
"installMaven": {
"type": "boolean",
"default": false,
"description": "Install Maven, a management tool for Java"
},
"mavenVersion": {
"type": "string",
"proposals": [
"latest",
"3.8.6",
"3.6.3",
"3.5.4"
],
"default": "latest",
"description": "Select or enter a Maven version"
},
"installAnt": {
"type": "boolean",
"default": false,
"description": "Install Ant, a software tool for automating software build processes"
},
"antVersion": {
"type": "string",
"proposals": [
"latest",
"1.10.12",
"1.9.15"
],
"default": "latest",
"description": "Select or enter an Ant version"
}
},
"buildArg": "_VSC_INSTALL_JAVA",
"customizations": {
"vscode": {
"extensions": [
@ -53,7 +89,7 @@
"containerEnv": {
"SDKMAN_DIR": "/usr/local/sdkman",
"JAVA_HOME": "/usr/local/sdkman/candidates/java/current",
"PATH": "/usr/local/sdkman/bin:/usr/local/sdkman/candidates/java/current/bin:/usr/local/sdkman/candidates/gradle/current/bin:/usr/local/sdkman/candidates/maven/current/bin:${PATH}"
"PATH": "/usr/local/sdkman/bin:/usr/local/sdkman/candidates/java/current/bin:/usr/local/sdkman/candidates/gradle/current/bin:/usr/local/sdkman/candidates/maven/current/bin:/usr/local/sdkman/candidates/ant/current/bin:${PATH}"
},
"installsAfter": [
"ghcr.io/devcontainers/features/common-utils"

33
src/java/install.sh Executable file → Normal file
View file

@ -9,18 +9,22 @@
#
# Syntax: ./java-debian.sh [JDK version] [SDKMAN_DIR] [non-root user] [Add to rc files flag]
JAVA_VERSION=${VERSION:-"lts"}
INSTALL_GRADLE=${INSTALLGRADLE:-"false"}
INSTALL_MAVEN=${INSTALLMAVEN:-"false"}
JDK_DISTRO=${JDKDISTRO}
JAVA_VERSION="${VERSION:-"lts"}"
INSTALL_GRADLE="${INSTALLGRADLE:-"false"}"
GRADLE_VERSION="${GRADLEVERSION:-"latest"}"
INSTALL_MAVEN="${INSTALLMAVEN:-"false"}"
MAVEN_VERSION="${MAVENVERSION:-"latest"}"
INSTALL_ANT="${INSTALLANT:-"false"}"
ANT_VERSION="${ANTVERSION:-"latest"}"
JDK_DISTRO="${JDKDISTRO}"
export SDKMAN_DIR=${SDKMAN_DIR:-"/usr/local/sdkman"}
USERNAME=${USERNAME:-"automatic"}
UPDATE_RC=${UPDATE_RC:-"true"}
export SDKMAN_DIR="${SDKMAN_DIR:-"/usr/local/sdkman"}"
USERNAME="${USERNAME:-"${_REMOTE_USER:-"automatic"}"}"
UPDATE_RC="${UPDATE_RC:-"true"}"
# Comma-separated list of java versions to be installed
# alongside JAVA_VERSION, but not set as default.
ADDITIONAL_VERSIONS=${ADDITIONALVERSIONS:-""}
ADDITIONAL_VERSIONS="${ADDITIONALVERSIONS:-""}"
set -e
@ -107,13 +111,13 @@ sdk_install() {
elif echo "${requested_version}" | grep -oE "${full_version_check}" > /dev/null 2>&1; then
echo "${requested_version}"
else
local regex="${prefix}\\K[0-9]+\\.[0-9]+\\.[0-9]+${suffix}"
local regex="${prefix}\\K[0-9]+\\.?[0-9]*\\.?[0-9]*${suffix}"
local version_list=$(su ${USERNAME} -c ". \${SDKMAN_DIR}/bin/sdkman-init.sh && sdk list ${install_type} 2>&1 | grep -oP \"${regex}\" | tr -d ' ' | sort -rV")
if [ "${requested_version}" = "latest" ] || [ "${requested_version}" = "current" ]; then
requested_version="$(echo "${version_list}" | head -n 1)"
else
set +e
requested_version="$(echo "${version_list}" | grep -E -m 1 "^${requested_version//./\\.}([\\.\\s]|$)")"
requested_version="$(echo "${version_list}" | grep -E -m 1 "^${requested_version//./\\.}([\\.\\s]|-|$)")"
set -e
fi
if [ -z "${requested_version}" ] || ! echo "${version_list}" | grep "^${requested_version//./\\.}$" > /dev/null 2>&1; then
@ -171,14 +175,19 @@ if [ ! -z "${ADDITIONAL_VERSIONS}" ]; then
su ${USERNAME} -c ". ${SDKMAN_DIR}/bin/sdkman-init.sh && sdk default java ${JAVA_VERSION}"
fi
# Install Ant
if [[ "${INSTALL_ANT}" = "true" ]] && ! ant -version > /dev/null; then
sdk_install ant ${ANT_VERSION}
fi
# Install Gradle
if [[ "${INSTALL_GRADLE}" = "true" ]] && ! gradle --version > /dev/null; then
sdk_install gradle latest
sdk_install gradle ${GRADLE_VERSION}
fi
# Install Maven
if [[ "${INSTALL_MAVEN}" = "true" ]] && ! mvn --version > /dev/null; then
sdk_install maven latest
sdk_install maven ${MAVEN_VERSION}
fi
# Clean up

View file

@ -3,11 +3,11 @@
set -e
JAVA_VERSION=${1:-"default"}
SDKMAN_DIR=${2:-"/usr/local/sdkman"}
USERNAME=${3:-"automatic"}
UPDATE_RC=${4:-"true"}
ADDITIONAL_JAVA_VERSION=11
JAVA_VERSION="${1:-"default"}"
SDKMAN_DIR="${2:-"/usr/local/sdkman"}"
USERNAME="${USERNAME:-"${_REMOTE_USER:-"automatic"}"}"
UPDATE_RC="${4:-"true"}"
ADDITIONAL_JAVA_VERSION="11"
cd "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
chmod +x install.sh

View file

@ -10,3 +10,10 @@ minikube addons enable ingress
# Run this to forward to localhost in the background
nohup kubectl port-forward --pod-running-timeout=24h -n ingress-nginx service/ingress-nginx-controller :80 &
```
## OS Support
This Feature should work on recent versions of Debian/Ubuntu-based distributions with the `apt` package manager installed.
`bash` is required to execute the `install.sh` script.

View file

@ -33,6 +33,13 @@ nohup kubectl port-forward --pod-running-timeout=24h -n ingress-nginx service/in
```
## OS Support
This Feature should work on recent versions of Debian/Ubuntu-based distributions with the `apt` package manager installed.
`bash` is required to execute the `install.sh` script.
---
_Note: This file was auto-generated from the [devcontainer-feature.json](https://github.com/devcontainers/features/blob/main/src/kubectl-helm-minikube/devcontainer-feature.json). Add additional notes to a `NOTES.md`._

View file

@ -1,6 +1,6 @@
{
"id": "kubectl-helm-minikube",
"version": "1.1.0",
"version": "1.1.5",
"name": "Kubectl, Helm, and Minikube",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/kubectl-helm-minikube",
"description": "Installs latest version of kubectl, Helm, and optionally minikube. Auto-detects latest versions and installs needed dependencies.",
@ -12,7 +12,8 @@
"none",
"1.23",
"1.22",
"1.21"
"1.21",
"none"
],
"default": "latest",
"description": "Select or enter a Kubernetes version to install"
@ -20,7 +21,8 @@
"helm": {
"type": "string",
"proposals": [
"latest"
"latest",
"none"
],
"default": "latest",
"description": "Select or enter a Helm version to install"
@ -28,7 +30,8 @@
"minikube": {
"type": "string",
"proposals": [
"latest"
"latest",
"none"
],
"default": "latest",
"description": "Select or enter a Minikube version to install"

View file

@ -14,15 +14,16 @@ rm -rf /var/lib/apt/lists/*
KUBECTL_VERSION="${VERSION:-"latest"}"
HELM_VERSION="${HELM:-"latest"}"
MINIKUBE_VERSION="${MINIKUBE:-"none"}" # latest is also valid
MINIKUBE_VERSION="${MINIKUBE:-"latest"}" # latest is also valid
KUBECTL_SHA256="${KUBECTL_SHA256:-"automatic"}"
HELM_SHA256="${HELM_SHA256:-"automatic"}"
MINIKUBE_SHA256="${MINIKUBE_SHA256:-"automatic"}"
USERNAME=${USERNAME:-"automatic"}
USERNAME="${USERNAME:-"${_REMOTE_USER:-"automatic"}"}"
HELM_GPG_KEYS_URI="https://raw.githubusercontent.com/helm/helm/main/KEYS"
GPG_KEY_SERVERS="keyserver hkp://keyserver.ubuntu.com:80
GPG_KEY_SERVERS="keyserver hkp://keyserver.ubuntu.com
keyserver hkp://keyserver.ubuntu.com:80
keyserver hkps://keys.openpgp.org
keyserver hkp://keyserver.pgp.com"
@ -53,22 +54,6 @@ if [ "$USERNAME" = "root" ]; then
USERHOME="/root"
fi
# Get central common setting
get_common_setting() {
if [ "${common_settings_file_loaded}" != "true" ]; then
curl -sfL "https://aka.ms/vscode-dev-containers/script-library/settings.env" 2>/dev/null -o /tmp/vsdc-settings.env || echo "Could not download settings file. Skipping."
common_settings_file_loaded=true
fi
if [ -f "/tmp/vsdc-settings.env" ]; then
local multi_line=""
if [ "$2" = "true" ]; then multi_line="-z"; fi
local result="$(grep ${multi_line} -oP "$1=\"?\K[^\"]+" /tmp/vsdc-settings.env | tr -d '\0')"
if [ ! -z "${result}" ]; then declare -g $1="${result}"; fi
fi
echo "$1=${!1}"
}
# Figure out correct version of a three part version number is not passed
find_version_from_git_tags() {
local variable_name=$1
@ -137,62 +122,64 @@ case $architecture in
*) echo "(!) Architecture $architecture unsupported"; exit 1 ;;
esac
# Install the kubectl, verify checksum
echo "Downloading kubectl..."
if [ "${KUBECTL_VERSION}" = "latest" ] || [ "${KUBECTL_VERSION}" = "lts" ] || [ "${KUBECTL_VERSION}" = "current" ] || [ "${KUBECTL_VERSION}" = "stable" ]; then
if [ ${KUBECTL_VERSION} != "none" ]; then
# Install the kubectl, verify checksum
echo "Downloading kubectl..."
if [ "${KUBECTL_VERSION}" = "latest" ] || [ "${KUBECTL_VERSION}" = "lts" ] || [ "${KUBECTL_VERSION}" = "current" ] || [ "${KUBECTL_VERSION}" = "stable" ]; then
KUBECTL_VERSION="$(curl -sSL https://dl.k8s.io/release/stable.txt)"
else
else
find_version_from_git_tags KUBECTL_VERSION https://github.com/kubernetes/kubernetes
fi
if [ "${KUBECTL_VERSION::1}" != 'v' ]; then
fi
if [ "${KUBECTL_VERSION::1}" != 'v' ]; then
KUBECTL_VERSION="v${KUBECTL_VERSION}"
fi
curl -sSL -o /usr/local/bin/kubectl "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/${architecture}/kubectl"
chmod 0755 /usr/local/bin/kubectl
if [ "$KUBECTL_SHA256" = "automatic" ]; then
fi
curl -sSL -o /usr/local/bin/kubectl "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/${architecture}/kubectl"
chmod 0755 /usr/local/bin/kubectl
if [ "$KUBECTL_SHA256" = "automatic" ]; then
KUBECTL_SHA256="$(curl -sSL "https://dl.k8s.io/${KUBECTL_VERSION}/bin/linux/${architecture}/kubectl.sha256")"
fi
([ "${KUBECTL_SHA256}" = "dev-mode" ] || (echo "${KUBECTL_SHA256} */usr/local/bin/kubectl" | sha256sum -c -))
if ! type kubectl > /dev/null 2>&1; then
fi
([ "${KUBECTL_SHA256}" = "dev-mode" ] || (echo "${KUBECTL_SHA256} */usr/local/bin/kubectl" | sha256sum -c -))
if ! type kubectl > /dev/null 2>&1; then
echo '(!) kubectl installation failed!'
exit 1
fi
fi
# kubectl bash completion
kubectl completion bash > /etc/bash_completion.d/kubectl
# kubectl bash completion
kubectl completion bash > /etc/bash_completion.d/kubectl
# kubectl zsh completion
if [ -e "${USERHOME}}/.oh-my-zsh" ]; then
# kubectl zsh completion
if [ -e "${USERHOME}}/.oh-my-zsh" ]; then
mkdir -p "${USERHOME}/.oh-my-zsh/completions"
kubectl completion zsh > "${USERHOME}/.oh-my-zsh/completions/_kubectl"
chown -R "${USERNAME}" "${USERHOME}/.oh-my-zsh"
fi
fi
# Install Helm, verify signature and checksum
echo "Downloading Helm..."
find_version_from_git_tags HELM_VERSION "https://github.com/helm/helm"
if [ "${HELM_VERSION::1}" != 'v' ]; then
if [ ${HELM_VERSION} != "none" ]; then
# Install Helm, verify signature and checksum
echo "Downloading Helm..."
find_version_from_git_tags HELM_VERSION "https://github.com/helm/helm"
if [ "${HELM_VERSION::1}" != 'v' ]; then
HELM_VERSION="v${HELM_VERSION}"
fi
mkdir -p /tmp/helm
helm_filename="helm-${HELM_VERSION}-linux-${architecture}.tar.gz"
tmp_helm_filename="/tmp/helm/${helm_filename}"
curl -sSL "https://get.helm.sh/${helm_filename}" -o "${tmp_helm_filename}"
curl -sSL "https://github.com/helm/helm/releases/download/${HELM_VERSION}/${helm_filename}.asc" -o "${tmp_helm_filename}.asc"
export GNUPGHOME="/tmp/helm/gnupg"
mkdir -p "${GNUPGHOME}"
chmod 700 ${GNUPGHOME}
get_common_setting HELM_GPG_KEYS_URI
get_common_setting GPG_KEY_SERVERS true
curl -sSL "${HELM_GPG_KEYS_URI}" -o /tmp/helm/KEYS
echo -e "disable-ipv6\n${GPG_KEY_SERVERS}" > ${GNUPGHOME}/dirmngr.conf
gpg -q --import "/tmp/helm/KEYS"
if ! gpg --verify "${tmp_helm_filename}.asc" > ${GNUPGHOME}/verify.log 2>&1; then
fi
mkdir -p /tmp/helm
helm_filename="helm-${HELM_VERSION}-linux-${architecture}.tar.gz"
tmp_helm_filename="/tmp/helm/${helm_filename}"
curl -sSL "https://get.helm.sh/${helm_filename}" -o "${tmp_helm_filename}"
curl -sSL "https://github.com/helm/helm/releases/download/${HELM_VERSION}/${helm_filename}.asc" -o "${tmp_helm_filename}.asc"
export GNUPGHOME="/tmp/helm/gnupg"
mkdir -p "${GNUPGHOME}"
chmod 700 ${GNUPGHOME}
curl -sSL "${HELM_GPG_KEYS_URI}" -o /tmp/helm/KEYS
echo -e "disable-ipv6\n${GPG_KEY_SERVERS}" > ${GNUPGHOME}/dirmngr.conf
gpg -q --import "/tmp/helm/KEYS"
if ! gpg --verify "${tmp_helm_filename}.asc" > ${GNUPGHOME}/verify.log 2>&1; then
echo "Verification failed!"
cat /tmp/helm/gnupg/verify.log
exit 1
fi
if [ "${HELM_SHA256}" = "automatic" ]; then
fi
if [ "${HELM_SHA256}" = "automatic" ]; then
curl -sSL "https://get.helm.sh/${helm_filename}.sha256" -o "${tmp_helm_filename}.sha256"
curl -sSL "https://github.com/helm/helm/releases/download/${HELM_VERSION}/${helm_filename}.sha256.asc" -o "${tmp_helm_filename}.sha256.asc"
if ! gpg --verify "${tmp_helm_filename}.sha256.asc" > /tmp/helm/gnupg/verify.log 2>&1; then
@ -201,15 +188,17 @@ if [ "${HELM_SHA256}" = "automatic" ]; then
exit 1
fi
HELM_SHA256="$(cat "${tmp_helm_filename}.sha256")"
fi
([ "${HELM_SHA256}" = "dev-mode" ] || (echo "${HELM_SHA256} *${tmp_helm_filename}" | sha256sum -c -))
tar xf "${tmp_helm_filename}" -C /tmp/helm
mv -f "/tmp/helm/linux-${architecture}/helm" /usr/local/bin/
chmod 0755 /usr/local/bin/helm
rm -rf /tmp/helm
if ! type helm > /dev/null 2>&1; then
fi
([ "${HELM_SHA256}" = "dev-mode" ] || (echo "${HELM_SHA256} *${tmp_helm_filename}" | sha256sum -c -))
tar xf "${tmp_helm_filename}" -C /tmp/helm
mv -f "/tmp/helm/linux-${architecture}/helm" /usr/local/bin/
chmod 0755 /usr/local/bin/helm
rm -rf /tmp/helm
if ! type helm > /dev/null 2>&1; then
echo '(!) Helm installation failed!'
exit 1
fi
fi
# Install Minikube, verify checksum

View file

@ -26,3 +26,10 @@ sudo /usr/local/share/nix-entrypoint.sh
```
This same command can be used to restart the daemon if it has stopped for some reason. Logs are available at `/tmp/nix-daemon.log`.
## OS Support
This Feature should work on recent versions of Debian/Ubuntu-based distributions with the `apt` package manager installed.
`bash` is required to execute the `install.sh` script.

View file

@ -51,6 +51,13 @@ sudo /usr/local/share/nix-entrypoint.sh
This same command can be used to restart the daemon if it has stopped for some reason. Logs are available at `/tmp/nix-daemon.log`.
## OS Support
This Feature should work on recent versions of Debian/Ubuntu-based distributions with the `apt` package manager installed.
`bash` is required to execute the `install.sh` script.
---
_Note: This file was auto-generated from the [devcontainer-feature.json](https://github.com/devcontainers/features/blob/main/src/nix/devcontainer-feature.json). Add additional notes to a `NOTES.md`._

View file

@ -1,6 +1,6 @@
{
"id": "nix",
"version": "1.1.0",
"version": "1.1.3",
"name": "Nix Package Manager",
"documentationURL": "https://github.com/devcontainers/features/tree/main/src/nix",
"description": "Installs the Nix package manager and optionally a set of packages.",

View file

@ -12,12 +12,6 @@ FLAKEURI="${FLAKEURI:-""}"
EXTRANIXCONFIG="${EXTRANIXCONFIG:-""}"
USERNAME="${USERNAME:-"${_REMOTE_USER:-"automatic"}"}"
# Nix keys for securly verifying installer download signature per https://nixos.org/download.html#nix-verify-installation
NIX_GPG_KEYS="B541D55301270E0BCF15CA5D8170B4726D7198DE"
GPG_KEY_SERVERS="keyserver hkp://keyserver.ubuntu.com:80
keyserver hkps://keys.openpgp.org
keyserver hkp://keyserver.pgp.com"
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
@ -61,10 +55,6 @@ else
find_prev_version_from_git_tags VERSION https://github.com/NixOS/nix "tags/"
curl -sSLf -o "${tmpdir}/install-nix" https://releases.nixos.org/nix/nix-${VERSION}/install
fi
curl -sSLf -o "${tmpdir}/install-nix.asc" https://releases.nixos.org/nix/nix-${VERSION}/install.asc
cd "${tmpdir}"
receive_gpg_keys NIX_GPG_KEYS
gpg2 --verify ./install-nix.asc
cd "${FEATURE_DIR}"
# Do a multi or single-user setup based on feature config

View file

@ -15,7 +15,7 @@ if ! pidof nix-daemon > /dev/null 2>&1; then
fi
fi
if [ "${start_ok}" = "false" ]; then
echo -e 'Failed to start nix-daemon as root. Set multiUser to false in your feature configuraiton if you would\nprefer to run the container as a non-root. You may also start the daemon manually if you have sudo\ninstalled and configured for your user by running "sudo -c nix-daemon &"'
echo -e 'Failed to start nix-daemon as root. Set multiUser to false in your feature configuration if you would\nprefer to run the container as a non-root. You may also start the daemon manually if you have sudo\ninstalled and configured for your user by running "sudo -c nix-daemon &"'
fi
fi
exec "$@"

View file

@ -82,41 +82,6 @@ detect_user() {
fi
}
# Import the specified key in a variable name passed in as
receive_gpg_keys() {
local keys=${!1}
local keyring_args=""
if [ ! -z "$2" ]; then
mkdir -p "$(dirname \"$2\")"
keyring_args="--no-default-keyring --keyring $2"
fi
# Use a temporary locaiton for gpg keys to avoid polluting image
export GNUPGHOME="/tmp/tmp-gnupg"
mkdir -p ${GNUPGHOME}
chmod 700 ${GNUPGHOME}
echo -e "disable-ipv6\n${GPG_KEY_SERVERS}" > ${GNUPGHOME}/dirmngr.conf
# GPG key download sometimes fails for some reason and retrying fixes it.
local retry_count=0
local gpg_ok="false"
set +e
until [ "${gpg_ok}" = "true" ] || [ "${retry_count}" -eq "5" ];
do
echo "(*) Downloading GPG key..."
( echo "${keys}" | xargs -n 1 gpg -q ${keyring_args} --recv-keys) 2>&1 && gpg_ok="true"
if [ "${gpg_ok}" != "true" ]; then
echo "(*) Failed getting key, retring in 10s..."
(( retry_count++ ))
sleep 10s
fi
done
set -e
if [ "${gpg_ok}" = "false" ]; then
echo "(!) Failed to get gpg key."
exit 1
fi
}
# Figure out correct version of a three part version number is not passed
find_version_from_git_tags() {
local variable_name=$1
@ -282,9 +247,14 @@ find_prev_version_from_git_tags() {
major="$(echo "${current_version}" | grep -oE '^[0-9]+' || echo '')"
minor="$(echo "${current_version}" | grep -oP '^[0-9]+\.\K[0-9]+' || echo '')"
breakfix="$(echo "${current_version}" | grep -oP '^[0-9]+\.[0-9]+\.\K[0-9]+' 2>/dev/null || echo '')"
set -e
if [ "${minor}" = "0" ] && [ "${breakfix}" = "0" ]; then
((major=major-1))
declare -g ${variable_name}="${major}"
# Look for latest version from previous major release
find_version_from_git_tags "${variable_name}" "${repository}" "${prefix}" "${separator}" "${last_part_optional}"
# Handle situations like Go's odd version pattern where "0" releases omit the last part
if [ "${breakfix}" = "" ] || [ "${breakfix}" = "0" ]; then
elif [ "${breakfix}" = "" ] || [ "${breakfix}" = "0" ]; then
((minor=minor-1))
declare -g ${variable_name}="${major}.${minor}"
# Look for latest version from previous minor release
@ -297,4 +267,6 @@ find_prev_version_from_git_tags() {
declare -g ${variable_name}="${major}.${minor}.${breakfix}"
fi
fi
set -e
}

View file

@ -16,3 +16,10 @@ Alternatively, you can start up an interactive shell which will in turn source `
"postCreateCommand": "bash -i -c 'nvm install --lts'"
```
## OS Support
This Feature should work on recent versions of Debian/Ubuntu-based distributions with the `apt` package manager installed.
`bash` is required to execute the `install.sh` script.

View file

@ -1,7 +1,7 @@
# Node.js (via nvm) and yarn (node)
# Node.js (via nvm), yarn and pnpm (node)
Installs Node.js, nvm, yarn, and needed dependencies.
Installs Node.js, nvm, yarn, pnpm, and needed dependencies.
## Example Usage
@ -18,7 +18,13 @@ Installs Node.js, nvm, yarn, and needed dependencies.
| version | Select or enter a Node.js version to install | string | lts |
| nodeGypDependencies | Install dependencies to compile native node modules (node-gyp)? | boolean | true |
| nvmInstallPath | The path where NVM will be installed. | string | /usr/local/share/nvm |
| nvmVersion | Version of NVM to install. | string | 0.39.2 |
| nvmVersion | Version of NVM to install. | string | latest |
## Customizations
### VS Code Extensions
- `dbaeumer.vscode-eslint`
## Using nvm from postCreateCommand or another lifecycle command
@ -40,6 +46,13 @@ Alternatively, you can start up an interactive shell which will in turn source `
## OS Support
This Feature should work on recent versions of Debian/Ubuntu-based distributions with the `apt` package manager installed.
`bash` is required to execute the `install.sh` script.
---
_Note: This file was auto-generated from the [devcontainer-feature.json](https://github.com/devcontainers/features/blob/main/src/node/devcontainer-feature.json). Add additional notes to a `NOTES.md`._

Some files were not shown because too many files have changed in this diff Show more