Skip to content

Commit

Permalink
chore: Update devcontainer feature for Alpine Magento Cloud CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
cirolosapio committed Apr 20, 2024
1 parent 53221b8 commit d1360eb
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
13 changes: 12 additions & 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.2",
"version": "0.0.3",
"description": "Installs magento-cloud-cli on alpine",
"documentationURL": "https://github.com/cirolosapio/devcontainers-features/tree/main/src/alpine-magento-cloud-cli",
"installsAfter": [
Expand All @@ -11,5 +11,16 @@
"ghcr.io/cirolosapio/devcontainers-features/alpine-php-pcntl": {},
"ghcr.io/cirolosapio/devcontainers-features/alpine-php-posix": {},
"ghcr.io/cirolosapio/devcontainers-features/alpine-openssh": {}
},
"options": {
"shellType": {
"description": "The shell type to use",
"type": "string",
"default": "zsh",
"enum": [
"zsh",
"bash"
]
}
}
}
9 changes: 7 additions & 2 deletions src/alpine-magento-cloud-cli/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,19 @@ set -e

echo "Activating feature 'alpine-magento-cloud-cli'"

apk --no-cache add curl
apk --no-cache add curl git

CURRENT_USER=$(awk -v val=1000 -F ":" '$3==val{print $1}' /etc/passwd)

CMD="cd $_CONTAINER_USER_HOME && curl -sS https://accounts.magento.cloud/cli/installer | php"

if command -v zsh &> /dev/null; then
if [ "$SHELLTYPE" = "zsh" ]; then
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"
fi

su -c "$CMD" $CURRENT_USER
Expand Down

0 comments on commit d1360eb

Please sign in to comment.