From 62d732caff03302dc27714b397e430a8062fba5a Mon Sep 17 00:00:00 2001 From: cirolosapio Date: Tue, 23 Apr 2024 11:31:22 +0200 Subject: [PATCH] feat: Add installation scripts for Alpine user, PHP zip, PHP MySQL, and PHP Magento This commit adds installation scripts for four new features in the Alpine devcontainer. The scripts activate the 'alpine-user', 'alpine-php-zip', 'alpine-php-mysql', and 'alpine-php-magento' features respectively. Each script installs the necessary dependencies and enables the corresponding PHP extensions. --- README.md | 5 +++ src/alpine-bat/devcontainer-feature.json | 2 +- src/alpine-bat/install.sh | 12 ++++- .../devcontainer-feature.json | 10 ++--- .../install.sh | 44 +++++++++++++------ .../devcontainer-feature.json | 2 +- src/alpine-gh-copilot-cli/install.sh | 10 ++++- .../devcontainer-feature.json | 2 +- src/alpine-magento-cloud-cli/install.sh | 20 ++++++--- .../devcontainer-feature.json | 2 +- src/alpine-n98-magerun2/install.sh | 10 +++++ src/alpine-navi/devcontainer-feature.json | 2 +- src/alpine-navi/install.sh | 10 +++++ src/alpine-node/devcontainer-feature.json | 2 +- src/alpine-node/install.sh | 2 +- src/alpine-nushell/devcontainer-feature.json | 11 +---- src/alpine-nushell/install.sh | 12 ++++- src/alpine-ohmyzsh/devcontainer-feature.json | 9 +--- src/alpine-ohmyzsh/install.sh | 15 +++++-- .../devcontainer-feature.json | 6 +-- .../devcontainer-feature.json | 11 +++++ src/alpine-php-magento/install.sh | 12 +++++ .../devcontainer-feature.json | 7 +++ src/alpine-php-mssql/install.sh | 23 ++++++++++ .../devcontainer-feature.json | 7 +++ src/alpine-php-mysql/install.sh | 11 +++++ src/alpine-php-zip/devcontainer-feature.json | 7 +++ src/alpine-php-zip/install.sh | 10 +++++ src/alpine-user/devcontainer-feature.json | 14 ++++++ src/alpine-user/install.sh | 9 ++++ 30 files changed, 241 insertions(+), 58 deletions(-) create mode 100644 src/alpine-php-magento/devcontainer-feature.json create mode 100644 src/alpine-php-magento/install.sh create mode 100644 src/alpine-php-mssql/devcontainer-feature.json create mode 100644 src/alpine-php-mssql/install.sh create mode 100644 src/alpine-php-mysql/devcontainer-feature.json create mode 100644 src/alpine-php-mysql/install.sh create mode 100644 src/alpine-php-zip/devcontainer-feature.json create mode 100644 src/alpine-php-zip/install.sh create mode 100755 src/alpine-user/devcontainer-feature.json create mode 100755 src/alpine-user/install.sh diff --git a/README.md b/README.md index 46d1ba3..84d4c82 100644 --- a/README.md +++ b/README.md @@ -25,9 +25,14 @@ - [alpine-php-composer](https://github.com/cirolosapio/devcontainers-features/pkgs/container/devcontainers-features%2Falpine-php-composer) - [alpine-php-gd](https://github.com/cirolosapio/devcontainers-features/pkgs/container/devcontainers-features%2Falpine-php-gd) - [alpine-php-intl](https://github.com/cirolosapio/devcontainers-features/pkgs/container/devcontainers-features%2Falpine-php-intl) +- [alpine-php-magento](https://github.com/cirolosapio/devcontainers-features/pkgs/container/devcontainers-features%2Falpine-php-magento) +- [alpine-php-mssql](https://github.com/cirolosapio/devcontainers-features/pkgs/container/devcontainers-features%2Falpine-php-mssql) +- [alpine-php-mysql](https://github.com/cirolosapio/devcontainers-features/pkgs/container/devcontainers-features%2Falpine-php-mysql) - [alpine-php-pcntl](https://github.com/cirolosapio/devcontainers-features/pkgs/container/devcontainers-features%2Falpine-php-pcntl) - [alpine-php-pgsql](https://github.com/cirolosapio/devcontainers-features/pkgs/container/devcontainers-features%2Falpine-php-pgsql) - [alpine-php-posix](https://github.com/cirolosapio/devcontainers-features/pkgs/container/devcontainers-features%2Falpine-php-posix) - [alpine-php-xdebug](https://github.com/cirolosapio/devcontainers-features/pkgs/container/devcontainers-features%2Falpine-php-xdebug) +- [alpine-php-zip](https://github.com/cirolosapio/devcontainers-features/pkgs/container/devcontainers-features%2Falpine-php-zip) - [alpine-phpstorm-libs](https://github.com/cirolosapio/devcontainers-features/pkgs/container/devcontainers-features%2Falpine-phpstorm-libs) - [alpine-starship](https://github.com/cirolosapio/devcontainers-features/pkgs/container/devcontainers-features%2Falpine-starship) +- [alpine-user](https://github.com/cirolosapio/devcontainers-features/pkgs/container/devcontainers-features%2Falpine-user) diff --git a/src/alpine-bat/devcontainer-feature.json b/src/alpine-bat/devcontainer-feature.json index 34ef299..7b278f7 100644 --- a/src/alpine-bat/devcontainer-feature.json +++ b/src/alpine-bat/devcontainer-feature.json @@ -1,7 +1,7 @@ { "name": "alpine-bat", "id": "alpine-bat", - "version": "0.0.9", + "version": "0.0.10", "description": "Installs bat on alpine", "documentationURL": "https://github.com/cirolosapio/devcontainers-features/tree/main/src/alpine-bat", "installsAfter": [ diff --git a/src/alpine-bat/install.sh b/src/alpine-bat/install.sh index 116a27b..ecfa1da 100644 --- a/src/alpine-bat/install.sh +++ b/src/alpine-bat/install.sh @@ -7,8 +7,18 @@ echo "Activating feature 'alpine-bat'" 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 + _CONTAINER_USER_HOME=/root + else + _CONTAINER_USER_HOME=$(getent passwd $CURRENT_USER | cut -d: -f6) + fi + fi + apk --no-cache add bat-zsh-completion - echo "alias cat=bat" >> $_CONTAINER_USER_HOME/.zshrc + echo $'\nalias cat=bat' >> $_CONTAINER_USER_HOME/.zshrc fi echo 'Done!' \ No newline at end of file diff --git a/src/alpine-docker-outside-of-docker/devcontainer-feature.json b/src/alpine-docker-outside-of-docker/devcontainer-feature.json index 80c95d2..e44cc1e 100644 --- a/src/alpine-docker-outside-of-docker/devcontainer-feature.json +++ b/src/alpine-docker-outside-of-docker/devcontainer-feature.json @@ -1,28 +1,24 @@ { "name": "alpine-docker-outside-of-docker", "id": "alpine-docker-outside-of-docker", - "version": "0.0.10", + "version": "0.0.11", "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", "legacyIds": [ "alpine-docker" ], "options": { - "hostDockerGid": { - "type": "string", - "default": "1001", - "description": "Docker group id on the host machine (retrieve with \"getent group docker \\| cut -d: -f3\"). Required if remote user is not root" - }, "installDockerCompose": { "type": "boolean", "default": false, "description": "Install Docker Compose?" } }, + "entrypoint": "/usr/local/share/docker-init.sh", "mounts": [ { "source": "/var/run/docker.sock", - "target": "/var/run/docker.sock", + "target": "/var/run/docker-host.sock", "type": "bind" } ], diff --git a/src/alpine-docker-outside-of-docker/install.sh b/src/alpine-docker-outside-of-docker/install.sh index 88357cf..3a49160 100644 --- a/src/alpine-docker-outside-of-docker/install.sh +++ b/src/alpine-docker-outside-of-docker/install.sh @@ -6,27 +6,45 @@ echo "Activating feature 'alpine-docker-outside-of-docker'" apk add --no-cache docker -CURRENT_USER=$(awk -v val=1000 -F ":" '$3==val{print $1}' /etc/passwd) -echo "CURRENT_USER is $CURRENT_USER" +CURRENT_USER=$(getent passwd 1000 | cut -d: -f1) if [[ -z $CURRENT_USER ]]; then - echo "CURRENT_USER is empty, using 'root'" + ln -s /var/run/docker-host.sock /var/run/docker.sock + echo -e '#!/bin/sh\nexec "$@"' > /usr/local/share/docker-init.sh else - echo "HOST_DOCKER_GID is $HOSTDOCKERGID" + apk add --no-cache socat sudo + echo "$CURRENT_USER ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/$CURRENT_USER + chmod 0440 /etc/sudoers.d/$CURRENT_USER - HOST_DOCKER_GROUP=$(getent group $HOSTDOCKERGID | cut -d: -f1) + tee /usr/local/share/docker-init.sh > /dev/null \ +<< EOF +#!/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. +#------------------------------------------------------------------------------------------------------------- + +set -e - if [[ -z $HOST_DOCKER_GROUP ]]; then - echo "HOST_DOCKER_GROUP is empty, creating new group 'host-docker'" - addgroup -g $HOSTDOCKERGID host-docker - HOST_DOCKER_GROUP=host-docker - else - echo "HOST_DOCKER_GROUP is already used, using existing group '$HOST_DOCKER_GROUP'" - fi +SOCAT_PATH_BASE=/tmp/vscr-docker-from-docker +SOCAT_PID=\${SOCAT_PATH_BASE}.pid - addgroup $CURRENT_USER $HOST_DOCKER_GROUP +if [ ! -f "\${SOCAT_PID}" ] || ! ps -p \$(cat \${SOCAT_PID}) > /dev/null; then + rm -rf /var/run/docker.sock + 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 fi +# Execute whatever commands were passed in (if any). This allows us +# to set this script to ENTRYPOINT while still executing the default CMD. +set +e +exec "\$@" +EOF + + chown ${CURRENT_USER}:root /usr/local/share/docker-init.sh +fi + +chmod +x /usr/local/share/docker-init.sh + if [[ $INSTALLDOCKERCOMPOSE == "true" ]]; then apk add --no-cache docker-compose fi diff --git a/src/alpine-gh-copilot-cli/devcontainer-feature.json b/src/alpine-gh-copilot-cli/devcontainer-feature.json index a273cca..aa145a5 100644 --- a/src/alpine-gh-copilot-cli/devcontainer-feature.json +++ b/src/alpine-gh-copilot-cli/devcontainer-feature.json @@ -1,7 +1,7 @@ { "name": "alpine-gh-copilot-cli", "id": "alpine-gh-copilot-cli", - "version": "0.0.11", + "version": "0.0.12", "description": "Installs Github Copilot CLI on alpine", "documentationURL": "https://github.com/cirolosapio/devcontainers-features/tree/main/src/alpine-gh-copilot-cli", "installsAfter": [ diff --git a/src/alpine-gh-copilot-cli/install.sh b/src/alpine-gh-copilot-cli/install.sh index e36b7ca..816b250 100644 --- a/src/alpine-gh-copilot-cli/install.sh +++ b/src/alpine-gh-copilot-cli/install.sh @@ -8,7 +8,15 @@ apk --no-cache add npm npm i -g @githubnext/github-copilot-cli if [[ $INITALIAS == "true" ]]; then - CURRENT_USER=$(awk -v val=1000 -F ":" '$3==val{print $1}' /etc/passwd) + CURRENT_USER=$(getent passwd 1000 | cut -d: -f1) + + if [ -z "$_CONTAINER_USER_HOME" ]; then + if [ -z "$CURRENT_USER" ]; then + _CONTAINER_USER_HOME=/root + else + _CONTAINER_USER_HOME=$(getent passwd $CURRENT_USER | cut -d: -f6) + fi + fi if [[ -z $CURRENT_USER ]]; then echo 'eval "$(github-copilot-cli alias -- "$0")"' >> $_CONTAINER_USER_HOME/.zshrc diff --git a/src/alpine-magento-cloud-cli/devcontainer-feature.json b/src/alpine-magento-cloud-cli/devcontainer-feature.json index cd6cf26..83ab2a3 100644 --- a/src/alpine-magento-cloud-cli/devcontainer-feature.json +++ b/src/alpine-magento-cloud-cli/devcontainer-feature.json @@ -1,7 +1,7 @@ { "name": "alpine-magento-cloud-cli", "id": "alpine-magento-cloud-cli", - "version": "0.0.3", + "version": "0.0.4", "description": "Installs magento-cloud-cli on alpine", "documentationURL": "https://github.com/cirolosapio/devcontainers-features/tree/main/src/alpine-magento-cloud-cli", "installsAfter": [ diff --git a/src/alpine-magento-cloud-cli/install.sh b/src/alpine-magento-cloud-cli/install.sh index bdee2f2..6b2ee14 100644 --- a/src/alpine-magento-cloud-cli/install.sh +++ b/src/alpine-magento-cloud-cli/install.sh @@ -6,17 +6,25 @@ echo "Activating feature 'alpine-magento-cloud-cli'" apk --no-cache add curl git -CURRENT_USER=$(awk -v val=1000 -F ":" '$3==val{print $1}' /etc/passwd) +CURRENT_USER=$(getent passwd 1000 | cut -d: -f1) + +if [ -z "$_CONTAINER_USER_HOME" ]; then + if [ -z "$CURRENT_USER" ]; then + _CONTAINER_USER_HOME=/root + else + _CONTAINER_USER_HOME=$(getent passwd $CURRENT_USER | cut -d: -f6) + fi +fi CMD="cd $_CONTAINER_USER_HOME && curl -sS https://accounts.magento.cloud/cli/installer | php" if [ "$SHELLTYPE" = "zsh" ]; then - apk --no-cache add zsh - sed -i "s|:/bin/ash|:/bin/zsh|g" /etc/passwd - CMD="$CMD -- --shell-type zsh" + apk --no-cache add zsh + sed -i "s|:/bin/ash|:/bin/zsh|g" /etc/passwd + CMD="$CMD -- --shell-type zsh" else - apk --no-cache add bash - CMD="$CMD -- --shell-type bash" + apk --no-cache add bash + CMD="$CMD -- --shell-type bash" fi su -c "$CMD" $CURRENT_USER diff --git a/src/alpine-n98-magerun2/devcontainer-feature.json b/src/alpine-n98-magerun2/devcontainer-feature.json index 7630de9..e6623ed 100644 --- a/src/alpine-n98-magerun2/devcontainer-feature.json +++ b/src/alpine-n98-magerun2/devcontainer-feature.json @@ -1,7 +1,7 @@ { "name": "alpine-n98-magerun2", "id": "alpine-n98-magerun2", - "version": "0.0.13", + "version": "0.0.14", "description": "Installs n98-magerun2 on alpine", "documentationURL": "https://github.com/cirolosapio/devcontainers-features/tree/main/src/alpine-n98-magerun2", "legacyIds": [ diff --git a/src/alpine-n98-magerun2/install.sh b/src/alpine-n98-magerun2/install.sh index b3f2e9d..80d2397 100644 --- a/src/alpine-n98-magerun2/install.sh +++ b/src/alpine-n98-magerun2/install.sh @@ -11,6 +11,16 @@ wget -q https://files.magerun.net/n98-magerun2-${VERSION}.phar -O /usr/local/bin 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 + _CONTAINER_USER_HOME=/root + else + _CONTAINER_USER_HOME=$(getent passwd $CURRENT_USER | cut -d: -f6) + fi + fi + # ZSH PLUGIN mkdir -p $_CONTAINER_USER_HOME/.oh-my-zsh/custom/plugins/n98-magerun2/ wget -q https://raw.githubusercontent.com/netz98/n98-magerun2/develop/res/autocompletion/zsh/n98-magerun2.plugin.zsh -O $_CONTAINER_USER_HOME/.oh-my-zsh/custom/plugins/n98-magerun2/n98-magerun2.plugin.zsh diff --git a/src/alpine-navi/devcontainer-feature.json b/src/alpine-navi/devcontainer-feature.json index d4fdb4f..39bd169 100644 --- a/src/alpine-navi/devcontainer-feature.json +++ b/src/alpine-navi/devcontainer-feature.json @@ -1,7 +1,7 @@ { "name": "alpine-navi", "id": "alpine-navi", - "version": "0.0.8", + "version": "0.0.9", "description": "Installs navi on alpine", "documentationURL": "https://github.com/cirolosapio/devcontainers-features/tree/main/src/alpine-navi", "installsAfter": [ diff --git a/src/alpine-navi/install.sh b/src/alpine-navi/install.sh index c013d5b..981001a 100644 --- a/src/alpine-navi/install.sh +++ b/src/alpine-navi/install.sh @@ -7,6 +7,16 @@ echo "Activating feature 'alpine-navi'" 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 + _CONTAINER_USER_HOME=/root + else + _CONTAINER_USER_HOME=$(getent passwd $CURRENT_USER | cut -d: -f6) + fi + fi + echo $'\neval "$(navi widget zsh)"' >> $_CONTAINER_USER_HOME/.zshrc fi diff --git a/src/alpine-node/devcontainer-feature.json b/src/alpine-node/devcontainer-feature.json index 901688d..e9c8547 100644 --- a/src/alpine-node/devcontainer-feature.json +++ b/src/alpine-node/devcontainer-feature.json @@ -1,7 +1,7 @@ { "name": "alpine-node", "id": "alpine-node", - "version": "0.0.9", + "version": "0.0.10", "description": "Installs node and npm on alpine", "documentationURL": "https://github.com/cirolosapio/devcontainers-features/tree/main/src/alpine-node", "options": { diff --git a/src/alpine-node/install.sh b/src/alpine-node/install.sh index 50ad4df..7534e63 100644 --- a/src/alpine-node/install.sh +++ b/src/alpine-node/install.sh @@ -10,7 +10,7 @@ if [[ $COREPACK == "true" ]]; then npm i -g corepack if [[ $PNPMVERSION != "latest" ]]; then - CURRENT_USER=$(awk -v val=1000 -F ":" '$3==val{print $1}' /etc/passwd) + CURRENT_USER=$(getent passwd 1000 | cut -d: -f1) su -c "corepack prepare pnpm@$PNPMVERSION --activate" $CURRENT_USER fi fi diff --git a/src/alpine-nushell/devcontainer-feature.json b/src/alpine-nushell/devcontainer-feature.json index 33be2e8..a8d7a95 100644 --- a/src/alpine-nushell/devcontainer-feature.json +++ b/src/alpine-nushell/devcontainer-feature.json @@ -1,17 +1,10 @@ { "name": "alpine-nushell", "id": "alpine-nushell", - "version": "0.0.8", + "version": "0.0.9", "description": "Installs nushell on alpine", "documentationURL": "https://github.com/cirolosapio/devcontainers-features/tree/main/src/alpine-nushell", "installsAfter": [ "ghcr.io/cirolosapio/devcontainers-features/alpine-starship" - ], - "options": { - "initStarship": { - "type": "boolean", - "default": true, - "description": "Init starship" - } - } + ] } \ No newline at end of file diff --git a/src/alpine-nushell/install.sh b/src/alpine-nushell/install.sh index 97c059f..3ddccfe 100644 --- a/src/alpine-nushell/install.sh +++ b/src/alpine-nushell/install.sh @@ -6,11 +6,21 @@ echo "Activating feature 'alpine-nushell'" apk --no-cache add nushell --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing +if [ -z "$_CONTAINER_USER_HOME" ]; then + CURRENT_USER=$(getent passwd 1000 | cut -d: -f1) + + if [ -z "$CURRENT_USER" ]; then + _CONTAINER_USER_HOME=/root + else + _CONTAINER_USER_HOME=$(getent passwd $CURRENT_USER | cut -d: -f6) + fi +fi + mkdir -p $_CONTAINER_USER_HOME/.config/nushell/ wget -q https://raw.githubusercontent.com/nushell/nushell/main/crates/nu-utils/src/sample_config/default_config.nu -O $_CONTAINER_USER_HOME/.config/nushell/config.nu wget -q https://raw.githubusercontent.com/nushell/nushell/main/crates/nu-utils/src/sample_config/default_env.nu -O $_CONTAINER_USER_HOME/.config/nushell/env.nu -if [[ $INITSTARSHIP == "true" ]]; then +if command -v starship &> /dev/null; then echo $'\nmkdir ~/.cache/starship\nstarship init nu | save -f ~/.cache/starship/init.nu' >> $_CONTAINER_USER_HOME/.config/nushell/env.nu echo $'\nuse ~/.cache/starship/init.nu' >> $_CONTAINER_USER_HOME/.config/nushell/config.nu fi diff --git a/src/alpine-ohmyzsh/devcontainer-feature.json b/src/alpine-ohmyzsh/devcontainer-feature.json index 2d2c962..8603635 100644 --- a/src/alpine-ohmyzsh/devcontainer-feature.json +++ b/src/alpine-ohmyzsh/devcontainer-feature.json @@ -1,7 +1,7 @@ { "name": "alpine-ohmyzsh", "id": "alpine-ohmyzsh", - "version": "0.0.17", + "version": "0.0.18", "description": "Installs ohmyzsh on alpine", "documentationURL": "https://github.com/cirolosapio/devcontainers-features/tree/main/src/alpine-ohmyzsh", "installsAfter": [ @@ -10,13 +10,8 @@ "options": { "plugins": { "type": "string", - "default": "alias-tips", + "default": "git alias-tips", "description": "OhMyZsh plugins to enable (git zsh-autosuggestions zsh-syntax-highlighting are always installed)" - }, - "initStarship": { - "type": "boolean", - "default": true, - "description": "Init starship" } } } \ No newline at end of file diff --git a/src/alpine-ohmyzsh/install.sh b/src/alpine-ohmyzsh/install.sh index 5ead305..7e09b8c 100644 --- a/src/alpine-ohmyzsh/install.sh +++ b/src/alpine-ohmyzsh/install.sh @@ -6,12 +6,21 @@ echo "Activating feature 'alpine-ohmyzsh'" apk --no-cache add git zsh -CURRENT_USER=$(awk -v val=1000 -F ":" '$3==val{print $1}' /etc/passwd) +CURRENT_USER=$(getent passwd 1000 | cut -d: -f1) + +if [ -z "$_CONTAINER_USER_HOME" ]; then + if [ -z "$CURRENT_USER" ]; then + _CONTAINER_USER_HOME=/root + else + _CONTAINER_USER_HOME=$(getent passwd $CURRENT_USER | cut -d: -f6) + fi +fi + su -c "wget -qO- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh | sh -s" $CURRENT_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 -sed -i 's/plugins=(git)/plugins=(\n git\n zsh-autosuggestions\n zsh-syntax-highlighting\n)/' $_CONTAINER_USER_HOME/.zshrc +sed -i 's/plugins=(git)/plugins=(\n zsh-autosuggestions\n zsh-syntax-highlighting\n)/' $_CONTAINER_USER_HOME/.zshrc if echo "$PLUGINS" | grep -w -q "autojump"; then git clone https://github.com/wting/autojump $_CONTAINER_USER_HOME/.oh-my-zsh/custom/plugins/autojump @@ -34,7 +43,7 @@ for plugin in $PLUGINS; do sed -i "s/^plugins=(/plugins=(\n $plugin/g" $_CONTAINER_USER_HOME/.zshrc done -if [[ $INITSTARSHIP == "true" ]]; then +if command -v starship > /dev/null; then echo $'\neval "$(starship init zsh)"' >> $_CONTAINER_USER_HOME/.zshrc fi diff --git a/src/alpine-php-composer/devcontainer-feature.json b/src/alpine-php-composer/devcontainer-feature.json index cc379c4..28a274a 100644 --- a/src/alpine-php-composer/devcontainer-feature.json +++ b/src/alpine-php-composer/devcontainer-feature.json @@ -1,16 +1,16 @@ { "name": "alpine-php-composer", "id": "alpine-php-composer", - "version": "0.0.2", + "version": "0.0.3", "description": "Installs php composer on alpine", "documentationURL": "https://github.com/cirolosapio/devcontainers-features/tree/main/src/alpine-php-composer", "options": { "version": { "type": "string", - "default": "2.7.2", + "default": "2.7.4", "description": "Version of composer to install", "proposals": [ - "2.7.2", + "2.7.4", "2.6.6" ] } diff --git a/src/alpine-php-magento/devcontainer-feature.json b/src/alpine-php-magento/devcontainer-feature.json new file mode 100644 index 0000000..06153d7 --- /dev/null +++ b/src/alpine-php-magento/devcontainer-feature.json @@ -0,0 +1,11 @@ +{ + "name": "alpine-php-magento", + "id": "alpine-php-magento", + "version": "0.0.1", + "description": "Installs magento libs for php on alpine", + "documentationURL": "https://github.com/cirolosapio/devcontainers-features/tree/main/src/alpine-php-magento", + "dependsOn": { + "https://github.com/cirolosapio/devcontainers-features/tree/main/src/alpine-php-mysql": {}, + "https://github.com/cirolosapio/devcontainers-features/tree/main/src/alpine-php-zip": {} + } +} \ No newline at end of file diff --git a/src/alpine-php-magento/install.sh b/src/alpine-php-magento/install.sh new file mode 100644 index 0000000..e22beab --- /dev/null +++ b/src/alpine-php-magento/install.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +set -e + +echo "Activating feature 'alpine-php-magento'" + +apk --no-cache add patch icu-dev icu-data-full libpng-dev libjpeg-turbo-dev libxslt-dev libxml2-dev freetype-dev +docker-php-ext-configure gd --with-freetype --with-jpeg +# docker-php-ext-configure gd --with-gd --with-freetype-dir=/usr/include/ +docker-php-ext-install bcmath gd intl soap xsl sockets + +echo 'Done!' \ No newline at end of file diff --git a/src/alpine-php-mssql/devcontainer-feature.json b/src/alpine-php-mssql/devcontainer-feature.json new file mode 100644 index 0000000..419da7b --- /dev/null +++ b/src/alpine-php-mssql/devcontainer-feature.json @@ -0,0 +1,7 @@ +{ + "name": "alpine-php-mssql", + "id": "alpine-php-mssql", + "version": "0.0.1", + "description": "Installs mssql driver for php on alpine", + "documentationURL": "https://github.com/cirolosapio/devcontainers-features/tree/main/src/alpine-php-mssql" +} \ No newline at end of file diff --git a/src/alpine-php-mssql/install.sh b/src/alpine-php-mssql/install.sh new file mode 100644 index 0000000..fd6d20b --- /dev/null +++ b/src/alpine-php-mssql/install.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +set -e + +echo "Activating feature 'alpine-php-mssql'" + +apk --no-cache add curl + +# Download the desired package(s) +curl -O https://download.microsoft.com/download/3/5/5/355d7943-a338-41a7-858d-53b259ea33f5/msodbcsql18_18.3.3.1-1_amd64.apk +curl -O https://download.microsoft.com/download/3/5/5/355d7943-a338-41a7-858d-53b259ea33f5/mssql-tools18_18.3.1.1-1_amd64.apk + +#Install the package(s) +apk add --allow-untrusted msodbcsql18_18.3.3.1-1_amd64.apk +apk add --allow-untrusted mssql-tools18_18.3.1.1-1_amd64.apk +PATH="$PATH:/opt/mssql-tools18/bin" + +# PHP EXTENSIONS +apk --no-cache add unixodbc-dev +pecl install sqlsrv-5.12.0 pdo_sqlsrv-5.12.0 +docker-php-ext-enable sqlsrv pdo_sqlsrv + +echo 'Done!' \ No newline at end of file diff --git a/src/alpine-php-mysql/devcontainer-feature.json b/src/alpine-php-mysql/devcontainer-feature.json new file mode 100644 index 0000000..d187673 --- /dev/null +++ b/src/alpine-php-mysql/devcontainer-feature.json @@ -0,0 +1,7 @@ +{ + "name": "alpine-php-mysql", + "id": "alpine-php-mysql", + "version": "0.0.1", + "description": "Installs mysql driver for php on alpine", + "documentationURL": "https://github.com/cirolosapio/devcontainers-features/tree/main/src/alpine-php-mysql" +} \ No newline at end of file diff --git a/src/alpine-php-mysql/install.sh b/src/alpine-php-mysql/install.sh new file mode 100644 index 0000000..51a5b64 --- /dev/null +++ b/src/alpine-php-mysql/install.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +set -e + +echo "Activating feature 'alpine-php-mysql'" + +apk --no-cache add mysql-client +docker-php-ext-install pdo_mysql +docker-php-ext-enable pdo_mysql + +echo 'Done!' \ No newline at end of file diff --git a/src/alpine-php-zip/devcontainer-feature.json b/src/alpine-php-zip/devcontainer-feature.json new file mode 100644 index 0000000..48d9c27 --- /dev/null +++ b/src/alpine-php-zip/devcontainer-feature.json @@ -0,0 +1,7 @@ +{ + "name": "alpine-php-zip", + "id": "alpine-php-zip", + "version": "0.0.1", + "description": "Installs zip for php on alpine", + "documentationURL": "https://github.com/cirolosapio/devcontainers-features/tree/main/src/alpine-php-zip" +} \ No newline at end of file diff --git a/src/alpine-php-zip/install.sh b/src/alpine-php-zip/install.sh new file mode 100644 index 0000000..ca2a5e0 --- /dev/null +++ b/src/alpine-php-zip/install.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +set -e + +echo "Activating feature 'alpine-php-zip'" + +apk --no-cache add libzip-dev +docker-php-ext-install zip + +echo 'Done!' \ No newline at end of file diff --git a/src/alpine-user/devcontainer-feature.json b/src/alpine-user/devcontainer-feature.json new file mode 100755 index 0000000..d7628fb --- /dev/null +++ b/src/alpine-user/devcontainer-feature.json @@ -0,0 +1,14 @@ +{ + "name": "alpine-user", + "id": "alpine-user", + "version": "0.0.1", + "description": "Create a user on alpine", + "documentationURL": "https://github.com/cirolosapio/devcontainers-features/tree/main/src/alpine-user", + "options": { + "user": { + "type": "string", + "default": "vscode", + "description": "The name of the user to create" + } + } +} \ No newline at end of file diff --git a/src/alpine-user/install.sh b/src/alpine-user/install.sh new file mode 100755 index 0000000..13e7138 --- /dev/null +++ b/src/alpine-user/install.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +set -e + +echo "Activating feature 'alpine-user'" + +adduser -D $USER + +echo 'Done!' \ No newline at end of file