Skip to content

Commit

Permalink
chore: Update devcontainer feature versions and dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
cirolosapio committed Jul 13, 2024
1 parent e7bec6a commit 89ed886
Show file tree
Hide file tree
Showing 19 changed files with 40 additions and 55 deletions.
2 changes: 1 addition & 1 deletion src/alpine-bat/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "alpine-bat",
"id": "alpine-bat",
"version": "0.0.11",
"version": "0.0.12",
"description": "Installs bat on alpine",
"documentationURL": "https://github.com/cirolosapio/devcontainers-features/tree/main/src/alpine-bat",
"installsAfter": [
Expand Down
6 changes: 2 additions & 4 deletions src/alpine-bat/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@ apk --no-cache add bat

if command -v zsh &> /dev/null; then
if [ -z "$_CONTAINER_USER_HOME" ]; then
CURRENT_USER=$(getent passwd 1000 | cut -d: -f1)

if [ -z "$CURRENT_USER" ]; then
if [ -z "$_CONTAINER_USER" ]; then
_CONTAINER_USER_HOME=/root
else
_CONTAINER_USER_HOME=$(getent passwd $CURRENT_USER | cut -d: -f6)
_CONTAINER_USER_HOME=$(getent passwd $_CONTAINER_USER | cut -d: -f6)
fi
fi

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "alpine-docker-outside-of-docker",
"id": "alpine-docker-outside-of-docker",
"version": "0.0.17",
"version": "0.0.18",
"description": "Re-use the host docker socket, adding the Docker CLI to alpine container",
"documentationURL": "https://github.com/cirolosapio/devcontainers-features/tree/main/src/alpine-docker-outside-of-docker",
"installsAfter": [
Expand Down
12 changes: 5 additions & 7 deletions src/alpine-docker-outside-of-docker/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,13 @@ fi

apk --no-cache add docker

CURRENT_USER=$(getent passwd 1000 | cut -d: -f1)

if [[ -z $CURRENT_USER ]]; then
if [[ -z $_CONTAINER_USER ]]; then
ln -s /var/run/docker-host.sock /var/run/docker.sock
echo -e '#!/bin/sh\nexec "$@"' > /usr/local/share/docker-init.sh
else
apk --no-cache add socat sudo
echo "$CURRENT_USER ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/$CURRENT_USER
chmod 0440 /etc/sudoers.d/$CURRENT_USER
echo "$_CONTAINER_USER ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/$_CONTAINER_USER
chmod 0440 /etc/sudoers.d/$_CONTAINER_USER

tee /usr/local/share/docker-init.sh > /dev/null \
<< EOF
Expand All @@ -31,14 +29,14 @@ SOCAT_PATH_BASE=/tmp/vscr-docker-from-docker
SOCAT_PID=\${SOCAT_PATH_BASE}.pid
if [ ! -f "\$SOCAT_PID" ] || ! kill -0 \$(cat \$SOCAT_PID) 2>/dev/null; then
(sudo socat UNIX-LISTEN:/var/run/docker.sock,fork,mode=660,user=$CURRENT_USER,backlog=128 UNIX-CONNECT:/var/run/docker-host.sock 2>&1 & echo \$! | tee \$SOCAT_PID > /dev/null)
(sudo socat UNIX-LISTEN:/var/run/docker.sock,fork,mode=660,user=$_CONTAINER_USER,backlog=128 UNIX-CONNECT:/var/run/docker-host.sock 2>&1 & echo \$! | tee \$SOCAT_PID > /dev/null)
fi
set +e
exec "\$@"
EOF

chown ${CURRENT_USER}:root /usr/local/share/docker-init.sh
chown ${_CONTAINER_USER}:root /usr/local/share/docker-init.sh
fi

chmod +x /usr/local/share/docker-init.sh
Expand Down
2 changes: 1 addition & 1 deletion src/alpine-gh-copilot-cli/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "alpine-gh-copilot-cli",
"id": "alpine-gh-copilot-cli",
"version": "0.0.14",
"version": "0.0.15",
"description": "Installs Github Copilot CLI on alpine",
"documentationURL": "https://github.com/cirolosapio/devcontainers-features/tree/main/src/alpine-gh-copilot-cli",
"deprecated": true,
Expand Down
10 changes: 4 additions & 6 deletions src/alpine-gh-copilot-cli/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,19 @@ if command -v zsh &> /dev/null || command -v bash &> /dev/null; then
RC_PROFILE=".bashrc"
fi

CURRENT_USER=$(getent passwd 1000 | cut -d: -f1)

if [ -z "$_CONTAINER_USER_HOME" ]; then
if [ -z "$CURRENT_USER" ]; then
if [ -z "$_CONTAINER_USER" ]; then
_CONTAINER_USER_HOME=/root
else
_CONTAINER_USER_HOME=$(getent passwd $CURRENT_USER | cut -d: -f6)
_CONTAINER_USER_HOME=$(getent passwd $_CONTAINER_USER | cut -d: -f6)
fi
fi

if [[ -z $CURRENT_USER ]]; then
if [[ -z $_CONTAINER_USER ]]; then
echo 'eval "$(github-copilot-cli alias -- "$0")"' >> $_CONTAINER_USER_HOME/$RC_PROFILE
else
CMD="echo 'eval \"\$(github-copilot-cli alias -- \"\$0\")\"' >> \$_CONTAINER_USER_HOME/$RC_PROFILE"
su -c "$CMD" $CURRENT_USER
su -c "$CMD" $_CONTAINER_USER
fi
fi

Expand Down
2 changes: 1 addition & 1 deletion src/alpine-magento-cloud-cli/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "alpine-magento-cloud-cli",
"id": "alpine-magento-cloud-cli",
"version": "0.0.6",
"version": "0.0.7",
"description": "Installs magento-cloud-cli on alpine",
"documentationURL": "https://github.com/cirolosapio/devcontainers-features/tree/main/src/alpine-magento-cloud-cli",
"installsAfter": [
Expand Down
8 changes: 3 additions & 5 deletions src/alpine-magento-cloud-cli/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@ echo "Activating feature 'alpine-magento-cloud-cli'"

apk --no-cache add curl git

CURRENT_USER=$(getent passwd 1000 | cut -d: -f1)

if [ -z "$_CONTAINER_USER_HOME" ]; then
if [ -z "$CURRENT_USER" ]; then
if [ -z "$_CONTAINER_USER" ]; then
_CONTAINER_USER_HOME=/root
else
_CONTAINER_USER_HOME=$(getent passwd $CURRENT_USER | cut -d: -f6)
_CONTAINER_USER_HOME=$(getent passwd $_CONTAINER_USER | cut -d: -f6)
fi
fi

Expand All @@ -28,6 +26,6 @@ else
CMD="$CMD -- --shell-type bash"
fi

su -c "$CMD" $CURRENT_USER
su -c "$CMD" $_CONTAINER_USER

echo 'Done!'
2 changes: 1 addition & 1 deletion src/alpine-n98-magerun2/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "alpine-n98-magerun2",
"id": "alpine-n98-magerun2",
"version": "0.0.16",
"version": "0.0.17",
"description": "Installs n98-magerun2 on alpine",
"documentationURL": "https://github.com/cirolosapio/devcontainers-features/tree/main/src/alpine-n98-magerun2",
"legacyIds": [
Expand Down
6 changes: 2 additions & 4 deletions src/alpine-n98-magerun2/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@ chmod +x /usr/local/bin/n98-magerun2.phar

if command -v zsh &> /dev/null; then
if [ -z "$_CONTAINER_USER_HOME" ]; then
CURRENT_USER=$(getent passwd 1000 | cut -d: -f1)

if [ -z "$CURRENT_USER" ]; then
if [ -z "$_CONTAINER_USER" ]; then
_CONTAINER_USER_HOME=/root
else
_CONTAINER_USER_HOME=$(getent passwd $CURRENT_USER | cut -d: -f6)
_CONTAINER_USER_HOME=$(getent passwd $_CONTAINER_USER | cut -d: -f6)
fi
fi

Expand Down
2 changes: 1 addition & 1 deletion src/alpine-navi/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "alpine-navi",
"id": "alpine-navi",
"version": "0.0.10",
"version": "0.0.11",
"description": "Installs navi on alpine",
"documentationURL": "https://github.com/cirolosapio/devcontainers-features/tree/main/src/alpine-navi",
"installsAfter": [
Expand Down
6 changes: 2 additions & 4 deletions src/alpine-navi/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@ apk --no-cache add skim navi

if command -v zsh &> /dev/null; then
if [ -z "$_CONTAINER_USER_HOME" ]; then
CURRENT_USER=$(getent passwd 1000 | cut -d: -f1)

if [ -z "$CURRENT_USER" ]; then
if [ -z "$_CONTAINER_USER" ]; then
_CONTAINER_USER_HOME=/root
else
_CONTAINER_USER_HOME=$(getent passwd $CURRENT_USER | cut -d: -f6)
_CONTAINER_USER_HOME=$(getent passwd $_CONTAINER_USER | cut -d: -f6)
fi
fi

Expand Down
2 changes: 1 addition & 1 deletion src/alpine-node/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "alpine-node",
"id": "alpine-node",
"version": "0.0.14",
"version": "0.0.15",
"description": "Installs node and npm on alpine",
"documentationURL": "https://github.com/cirolosapio/devcontainers-features/tree/main/src/alpine-node",
"installsAfter": [
Expand Down
3 changes: 1 addition & 2 deletions src/alpine-node/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ apk --no-cache add nodejs npm
if [[ $COREPACK == "true" ]]; then
npm i -g corepack

CURRENT_USER=$(getent passwd 1000 | cut -d: -f1)
su -c "corepack prepare pnpm@$PNPMVERSION --activate" $CURRENT_USER
su -c "corepack prepare pnpm@$PNPMVERSION --activate" $_CONTAINER_USER
fi

if [[ -n "$GLOBALPACKAGES" ]]; then
Expand Down
2 changes: 1 addition & 1 deletion src/alpine-nushell/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "alpine-nushell",
"id": "alpine-nushell",
"version": "0.0.12",
"version": "0.0.13",
"description": "Installs nushell on alpine",
"documentationURL": "https://github.com/cirolosapio/devcontainers-features/tree/main/src/alpine-nushell",
"installsAfter": [
Expand Down
10 changes: 4 additions & 6 deletions src/alpine-nushell/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@ echo "Activating feature 'alpine-nushell'"
apk --no-cache add nushell

if [ -z "$_CONTAINER_USER_HOME" ]; then
CURRENT_USER=$(getent passwd 1000 | cut -d: -f1)

if [ -z "$CURRENT_USER" ]; then
if [ -z "$_CONTAINER_USER" ]; then
_CONTAINER_USER_HOME=/root
else
_CONTAINER_USER_HOME=$(getent passwd $CURRENT_USER | cut -d: -f6)
_CONTAINER_USER_HOME=$(getent passwd $_CONTAINER_USER | cut -d: -f6)
fi
fi

Expand All @@ -27,8 +25,8 @@ if command -v starship &> /dev/null; then
echo $'\nuse ~/.cache/starship/init.nu' >> $_CONTAINER_USER_HOME/.config/nushell/config.nu
fi

if [ ! -z "$CURRENT_USER" ]; then
chown -R $CURRENT_USER $_CONTAINER_USER_HOME/.config/nushell
if [ ! -z "$_CONTAINER_USER" ]; then
chown -R $_CONTAINER_USER $_CONTAINER_USER_HOME/.config/nushell
fi

sed -i "s|:/bin/ash|:/usr/bin/nu|g" /etc/passwd
Expand Down
2 changes: 1 addition & 1 deletion src/alpine-ohmyzsh/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "alpine-ohmyzsh",
"id": "alpine-ohmyzsh",
"version": "0.0.20",
"version": "0.0.21",
"description": "Installs ohmyzsh on alpine",
"documentationURL": "https://github.com/cirolosapio/devcontainers-features/tree/main/src/alpine-ohmyzsh",
"installsAfter": [
Expand Down
10 changes: 4 additions & 6 deletions src/alpine-ohmyzsh/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,15 @@ echo "Activating feature 'alpine-ohmyzsh'"

apk --no-cache add git zsh

CURRENT_USER=$(getent passwd 1000 | cut -d: -f1)

if [ -z "$_CONTAINER_USER_HOME" ]; then
if [ -z "$CURRENT_USER" ]; then
if [ -z "$_CONTAINER_USER" ]; then
_CONTAINER_USER_HOME=/root
else
_CONTAINER_USER_HOME=$(getent passwd $CURRENT_USER | cut -d: -f6)
_CONTAINER_USER_HOME=$(getent passwd $_CONTAINER_USER | cut -d: -f6)
fi
fi

su -c "wget -qO- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh | sh -s" $CURRENT_USER
su -c "wget -qO- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh | sh -s" $_CONTAINER_USER

git clone https://github.com/zsh-users/zsh-autosuggestions $_CONTAINER_USER_HOME/.oh-my-zsh/custom/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting $_CONTAINER_USER_HOME/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting
Expand All @@ -25,7 +23,7 @@ sed -i 's/plugins=(git)/plugins=(\n zsh-autosuggestions\n zsh-syntax-highlight
if echo "$PLUGINS" | grep -w -q "autojump"; then
git clone https://github.com/wting/autojump $_CONTAINER_USER_HOME/.oh-my-zsh/custom/plugins/autojump
apk --no-cache add python3
su -c "cd $_CONTAINER_USER_HOME/.oh-my-zsh/custom/plugins/autojump/ && SHELL=zsh && ./install.py" $CURRENT_USER
su -c "cd $_CONTAINER_USER_HOME/.oh-my-zsh/custom/plugins/autojump/ && SHELL=zsh && ./install.py" $_CONTAINER_USER
echo $'\n[[ -s ~/.autojump/etc/profile.d/autojump.sh ]] && source ~/.autojump/etc/profile.d/autojump.sh' >> $_CONTAINER_USER_HOME/.zshrc
echo $'\nautoload -U compinit && compinit -u' >> $_CONTAINER_USER_HOME/.zshrc
fi
Expand Down
6 changes: 4 additions & 2 deletions src/alpine-php-xdebug/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "alpine-php-xdebug",
"id": "alpine-php-xdebug",
"version": "0.0.3",
"version": "0.0.4",
"description": "Installs php xdebug on alpine",
"documentationURL": "https://github.com/cirolosapio/devcontainers-features/tree/main/src/alpine-php-xdebug",
"options": {
Expand All @@ -14,7 +14,9 @@
"3.2.2",
"3.1.6",
"3.0.4",
"2.9.8"
"2.9.8",
"2.8.1",
"2.7.2"
]
}
}
Expand Down

0 comments on commit 89ed886

Please sign in to comment.