-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a408970
commit 1b21f43
Showing
18 changed files
with
408 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/ubuntu/.devcontainer/base.Dockerfile | ||
|
||
# [Choice] Ubuntu version (use ubuntu-22.04 or ubuntu-18.04 on local arm64/Apple Silicon): ubuntu-22.04, ubuntu-20.04, ubuntu-18.04 | ||
ARG VARIANT="jammy" | ||
FROM mcr.microsoft.com/vscode/devcontainers/base:0-${VARIANT} | ||
|
||
# [Optional] Uncomment this section to install additional OS packages. | ||
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ | ||
# && apt-get -y install --no-install-recommends <your-package-list-here> | ||
|
||
|
7 changes: 7 additions & 0 deletions
7
.stuartle.test-project/.devcontainer/azure-cli-persistence/NOTES.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
## Changelog | ||
|
||
| Version | Notes | | ||
| ------- | ------------------------------------------------------------ | | ||
| 0.0.3 | Rename existing ~/.azure folder to ~/.azure-old if it exists | | ||
| 0.0.1 | Initial version | |
32 changes: 32 additions & 0 deletions
32
.stuartle.test-project/.devcontainer/azure-cli-persistence/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
|
||
# Azure CLI Persistence (azure-cli-persistence) | ||
|
||
Preserve ~/.azure folder across container instances (avoids needing to login after rebuilding) | ||
|
||
## Example Usage | ||
|
||
```json | ||
"features": { | ||
"ghcr.io/stuartleeks/dev-container-features/azure-cli-persistence:0": { | ||
"version": "latest" | ||
} | ||
} | ||
``` | ||
|
||
## Options | ||
|
||
| Options Id | Description | Type | Default Value | | ||
|-----|-----|-----|-----| | ||
|
||
|
||
|
||
## Changelog | ||
|
||
| Version | Notes | | ||
| ------- | ------------------------------------------------------------ | | ||
| 0.0.3 | Rename existing ~/.azure folder to ~/.azure-old if it exists | | ||
| 0.0.1 | Initial version | | ||
|
||
--- | ||
|
||
_Note: This file was auto-generated from the [devcontainer-feature.json](https://github.com/stuartleeks/dev-container-features/blob/main/src/azure-cli-persistence/devcontainer-feature.json). Add additional notes to a `NOTES.md`._ |
17 changes: 17 additions & 0 deletions
17
.stuartle.test-project/.devcontainer/azure-cli-persistence/devcontainer-feature.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"name": "Azure CLI Persistence", | ||
"id": "azure-cli-persistence", | ||
"version": "0.0.3", | ||
"description": "Preserve ~/.azure folder across container instances (avoids needing to login after rebuilding)", | ||
"options": {}, | ||
"mounts": [ | ||
{ | ||
"source": "${devcontainerId}-azure", | ||
"target": "/dc/azure", | ||
"type": "volume" | ||
} | ||
], | ||
"installsAfter": [ | ||
"ghcr.io/devcontainers/features/azure-cli" | ||
] | ||
} |
32 changes: 32 additions & 0 deletions
32
.stuartle.test-project/.devcontainer/azure-cli-persistence/install.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
echo "Activating feature 'azure-cli-persistence'" | ||
echo "User: ${_REMOTE_USER} User home: ${_REMOTE_USER_HOME}" | ||
|
||
if [ -z "$_REMOTE_USER" ] || [ -z "$_REMOTE_USER_HOME" ]; then | ||
echo "***********************************************************************************" | ||
echo "*** Require _REMOTE_USER and _REMOTE_USER_HOME to be set (by dev container CLI) ***" | ||
echo "***********************************************************************************" | ||
exit 1 | ||
fi | ||
|
||
echo "Here...." | ||
|
||
|
||
if [ -e "$_REMOTE_USER_HOME/.azure" ]; then | ||
echo "Moving existing .azure folder to .azure-old" | ||
mv "$_REMOTE_USER_HOME/.azure" "$_REMOTE_USER_HOME/.azure-old" | ||
fi | ||
|
||
echo "Hi...." | ||
ls -al "$_REMOTE_USER_HOME" | ||
echo "Bye...." | ||
ln -s /dc/azure/ "$_REMOTE_USER_HOME/.azure" | ||
chown -R "${_REMOTE_USER}:${_REMOTE_USER}" "$_REMOTE_USER_HOME/.azure" | ||
|
||
# chown mount (only attached on startup) | ||
cat << EOF >> "$_REMOTE_USER_HOME/.bashrc" | ||
sudo chown -R "${_REMOTE_USER}:${_REMOTE_USER}" /dc/azure | ||
EOF | ||
chown -R $_REMOTE_USER $_REMOTE_USER_HOME/.bashrc |
26 changes: 26 additions & 0 deletions
26
.stuartle.test-project/.devcontainer/bash-completion/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
|
||
# Bash completion (bash-completion) | ||
|
||
Ensure bash-completion is installed | ||
|
||
## Example Usage | ||
|
||
```json | ||
"features": { | ||
"ghcr.io/stuartleeks/dev-container-features/bash-completion:0": { | ||
"version": "latest" | ||
} | ||
} | ||
``` | ||
|
||
## Options | ||
|
||
| Options Id | Description | Type | Default Value | | ||
|-----|-----|-----|-----| | ||
|
||
|
||
|
||
|
||
--- | ||
|
||
_Note: This file was auto-generated from the [devcontainer-feature.json](https://github.com/stuartleeks/dev-container-features/blob/main/src/bash-completion/devcontainer-feature.json). Add additional notes to a `NOTES.md`._ |
7 changes: 7 additions & 0 deletions
7
.stuartle.test-project/.devcontainer/bash-completion/devcontainer-feature.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"name": "Bash completion", | ||
"id": "bash-completion", | ||
"version": "0.0.1", | ||
"description": "Ensure bash-completion is installed", | ||
"options": {} | ||
} |
56 changes: 56 additions & 0 deletions
56
.stuartle.test-project/.devcontainer/bash-completion/install.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
USERNAME=${USERNAME:-"automatic"} | ||
|
||
# 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 | ||
|
||
if [[ "${USERNAME}" == "root" ]]; then | ||
USER_HOME=/root | ||
else | ||
USER_HOME=/home/${USERNAME} | ||
fi | ||
|
||
# 1 | ||
echo "****************************************************************************************" | ||
echo "****************************************************************************************" | ||
echo "****************************************************************************************" | ||
echo "Activating feature 'bash-completion'" | ||
echo "User: ${USERNAME} User home: ${USER_HOME}" | ||
|
||
if ! shopt -oq posix; then | ||
if [ -f /usr/share/bash-completion/bash_completion ]; then | ||
echo "completion file at /usr/share/bash-completion/bash_completion" | ||
echo -e "#bash-completion:\nsource /usr/share/bash-completion/bash_completion\n" >> "${USER_HOME}/.bashrc" | ||
elif [ -f /etc/bash_completion ]; then | ||
echo "completion file at /etc/bash_completion" | ||
echo -e "#bash-completion:\nsource /etc/bash_completion\n" >> "${USER_HOME}/.bashrc" | ||
else | ||
echo "bash-completion not found. Installing..." | ||
apt-get update | ||
apt-get install bash-completion | ||
echo -e "#bash-completion:\nsource /usr/share/bash-completion/bash_completion\n" >> "${USER_HOME}/.bashrc" | ||
echo "Updated ${USER_HOME}/.bashrc:" | ||
cat "${USER_HOME}/.bashrc" | ||
fi | ||
fi | ||
|
||
|
||
echo "****************************************************************************************" | ||
echo "****************************************************************************************" | ||
echo "****************************************************************************************" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: | ||
// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/ubuntu | ||
{ | ||
"name": "devcontainer-features-playground-test1", | ||
"build": { | ||
"dockerfile": "Dockerfile", | ||
// Update 'VARIANT' to pick an Ubuntu version: jammy / ubuntu-22.04, focal / ubuntu-20.04, bionic /ubuntu-18.04 | ||
// Use ubuntu-22.04 or ubuntu-18.04 on local arm64/Apple Silicon. | ||
"args": { | ||
"VARIANT": "ubuntu-22.04" | ||
} | ||
}, | ||
// Use 'forwardPorts' to make a list of ports inside the container available locally. | ||
// "forwardPorts": [], | ||
// Use 'postCreateCommand' to run commands after the container is created. | ||
// "postCreateCommand": "uname -a", | ||
// Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. | ||
"remoteUser": "vscode", | ||
"features": { | ||
// "./bash-completion": "latest" | ||
// "./bash-history" : "latest" | ||
"./shell-history" : {"version": "latest"}, | ||
"./azure-cli-persistence" : {"version": "latest"} | ||
// "ghcr.io/stuartleeks/dev-container-features/bash-history:0" : {"version": "latest"} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
## Changelog | ||
|
||
| Version | Notes | | ||
| ------- | ------------------------------------------------------------------- | | ||
| 0.0.3 | Set `HISTFILE_OLD` when replacing a previous `HSITFILE` value | | ||
| 0.0.2 | Initial work to reduce the requirement on `sudo` in `shell-history` | | ||
| 0.0.1 | Initial version | |
33 changes: 33 additions & 0 deletions
33
.stuartle.test-project/.devcontainer/shell-history/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
|
||
# Shell History (shell-history) | ||
|
||
Preserve shell history across dev container instances. Currently supports bash, zsh, and fish | ||
|
||
## Example Usage | ||
|
||
```json | ||
"features": { | ||
"ghcr.io/stuartleeks/dev-container-features/shell-history:0": { | ||
"version": "latest" | ||
} | ||
} | ||
``` | ||
|
||
## Options | ||
|
||
| Options Id | Description | Type | Default Value | | ||
|-----|-----|-----|-----| | ||
|
||
|
||
|
||
## Changelog | ||
|
||
| Version | Notes | | ||
| ------- | ------------------------------------------------------------------- | | ||
| 0.0.3 | Set `HISTFILE_OLD` when replacing a previous `HSITFILE` value | | ||
| 0.0.2 | Initial work to reduce the requirement on `sudo` in `shell-history` | | ||
| 0.0.1 | Initial version | | ||
|
||
--- | ||
|
||
_Note: This file was auto-generated from the [devcontainer-feature.json](https://github.com/stuartleeks/dev-container-features/blob/main/src/shell-history/devcontainer-feature.json). Add additional notes to a `NOTES.md`._ |
18 changes: 18 additions & 0 deletions
18
.stuartle.test-project/.devcontainer/shell-history/devcontainer-feature.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"name": "Shell History", | ||
"id": "shell-history", | ||
"version": "0.0.3", | ||
"description": "Preserve shell history across dev container instances. Currently supports bash, zsh, and fish", | ||
"options": {}, | ||
"mounts": [ | ||
{ | ||
"source": "${devcontainerId}-shellhistory", | ||
"target": "/dc/shellhistory", | ||
"type": "volume" | ||
} | ||
], | ||
"installsAfter": [ | ||
"ghcr.io/devcontainers/features/common-utils", | ||
"ghcr.io/meaningful-ooo/devcontainer-features/fish" | ||
] | ||
} |
54 changes: 54 additions & 0 deletions
54
.stuartle.test-project/.devcontainer/shell-history/install.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
echo "Activating feature 'shell-history'" | ||
echo "User: ${_REMOTE_USER} User home: ${_REMOTE_USER_HOME}" | ||
|
||
if [ -z "$_REMOTE_USER" ] || [ -z "$_REMOTE_USER_HOME" ]; then | ||
echo "***********************************************************************************" | ||
echo "*** Require _REMOTE_USER and _REMOTE_USER_HOME to be set (by dev container CLI) ***" | ||
echo "***********************************************************************************" | ||
exit 1 | ||
fi | ||
|
||
# | ||
# Generally, the installation favours configuring a shell to use the mounted volume | ||
# for storing history rather than symlinking as any operation to recreate files | ||
# could delete the symlink. | ||
# On shells where this isn't possible, we symlink as a fallback. | ||
# | ||
|
||
# Set HISTFILE for bash | ||
cat << EOF >> "$_REMOTE_USER_HOME/.bashrc" | ||
if [[ -z "\$HISTFILE_OLD" ]]; then | ||
export HISTFILE_OLD=\$HISTFILE | ||
fi | ||
export HISTFILE=/dc/shellhistory/.bash_history | ||
export PROMPT_COMMAND='history -a' | ||
sudo chown -R $_REMOTE_USER /dc/shellhistory | ||
EOF | ||
chown -R $_REMOTE_USER $_REMOTE_USER_HOME/.bashrc | ||
|
||
# Set HISTFILE for zsh | ||
cat << EOF >> "$_REMOTE_USER_HOME/.zshrc" | ||
export HISTFILE=/dc/shellhistory/.zsh_history | ||
export PROMPT_COMMAND='history -a' | ||
sudo chown -R $_REMOTE_USER /dc/shellhistory | ||
EOF | ||
chown -R $_REMOTE_USER $_REMOTE_USER_HOME/.zshrc | ||
|
||
# Create symlink for fish | ||
mkdir -p $_REMOTE_USER_HOME/.config/fish | ||
cat << EOF >> "$_REMOTE_USER_HOME/.config/fish/config.fish" | ||
if test -z "\$XDG_DATA_HOME" | ||
set history_location ~/.local/share/fish/fish_history | ||
else | ||
set history_location \$XDG_DATA_HOME/fish/fish_history | ||
end | ||
if test -f \$history_location | ||
mv \$history_location "\$history_location-old" | ||
end | ||
ln -s /dc/shellhistory/fish_history \$history_location | ||
sudo chown -R $_REMOTE_USER \$history_location | ||
EOF | ||
chown -R $_REMOTE_USER $_REMOTE_USER_HOME/.config/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | ||
|
||
rm -rf "$script_dir/.devcontainer/shell-history" | ||
cp -R "$script_dir/../src/shell-history" $script_dir/.devcontainer/shell-history | ||
|
||
rm -rf $script_dir/.devcontainer/azure-cli-persistence | ||
cp -R "$script_dir/../src/azure-cli-persistence" $script_dir/.devcontainer/azure-cli-persistence | ||
|
||
echo "" | devcontainer build --workspace-folder $script_dir |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
|
||
# Add Host (add-host) | ||
|
||
Add a hosts file entry in the dev container. | ||
|
||
|
||
## Example Usage | ||
|
||
```json | ||
"features": { | ||
"ghcr.io/stuartleeks/dev-container-features-playground/hugo:1": {} | ||
} | ||
``` | ||
|
||
## Options | ||
|
||
| Options Id | Description | Type | Default Value | | ||
|-----|-----|-----|-----| | ||
| host_name | Host name to add to the container's hosts file | string | host.docker.internal | | ||
| extended | The IP Address to associate with the host name | string | | | ||
|
||
|
||
|
||
--- | ||
|
||
_Note: This file was auto-generated from the [devcontainer-feature.json](https://github.com/stuartleeks/dev-container-features-playground/blob/main/src/add-host/devcontainer-feature.json). Add additional notes to a `NOTES.md`._ |
Oops, something went wrong.