Skip to content

Commit 363f1a8

Browse files
committed
feat: add Pulumi and GCloud devcontainer features
1 parent 5aade0c commit 363f1a8

7 files changed

Lines changed: 141 additions & 3 deletions

File tree

README.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ A collection of reusable [Dev Container Features](https://containers.dev/impleme
88
|---------|-------------|
99
| [antigravity-nix](src/features/antigravity-nix) | Creates vscode user, installs Nix with flakes, and essential tools |
1010
| [node](src/features/node) | Installs Node.js from NodeSource with version selection |
11+
| [gcloud](src/features/gcloud) | Installs Google Cloud CLI with Alpine support and versioning |
1112
| [gcloud-cli](src/features/gcloud-cli) | Installs Google Cloud CLI via official Debian packages |
13+
| [pulumi](src/features/pulumi) | Installs Pulumi CLI with Alpine support and versioning |
1214
| [dataform-cli](src/features/dataform-cli) | Installs Dataform CLI via npm |
1315

1416
## Usage
@@ -22,7 +24,8 @@ Add features to your `devcontainer.json`:
2224
"ghcr.io/duizendstra/devcontainer-features/node:1": {
2325
"version": "lts"
2426
},
25-
"ghcr.io/duizendstra/devcontainer-features/gcloud-cli:1": {},
27+
"ghcr.io/duizendstra/devcontainer-features/gcloud:1": {},
28+
"ghcr.io/duizendstra/devcontainer-features/pulumi:1": {},
2629
"ghcr.io/duizendstra/devcontainer-features/dataform-cli:1": {}
2730
}
2831
}
@@ -32,6 +35,8 @@ Add features to your `devcontainer.json`:
3235

3336
```
3437
antigravity-nix → node → dataform-cli
38+
→ gcloud
39+
→ pulumi
3540
→ gcloud-cli
3641
```
3742

@@ -44,10 +49,10 @@ Features are automatically ordered based on their dependencies.
4449
```
4550
src/features/
4651
├── antigravity-nix/
47-
│ ├── devcontainer-feature.json
48-
│ └── install.sh
4952
├── node/
53+
├── gcloud/
5054
├── gcloud-cli/
55+
├── pulumi/
5156
└── dataform-cli/
5257
5358
test/features/
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"id": "gcloud",
3+
"version": "1.0.0",
4+
"name": "Google Cloud CLI",
5+
"description": "Installs the Google Cloud CLI via official repositories",
6+
"options": {
7+
"version": {
8+
"type": "string",
9+
"description": "GCloud version (latest, or specific version)",
10+
"default": "latest"
11+
}
12+
},
13+
"installsAfter": [
14+
"ghcr.io/duizendstra/devcontainer-features/antigravity-nix"
15+
]
16+
}

src/features/gcloud/install.sh

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
VERSION=${VERSION:-"latest"}
5+
6+
echo "=== GCloud Feature ==="
7+
echo "Target version: ${VERSION}"
8+
9+
if [ -f /etc/debian_version ]; then
10+
apt-get update
11+
apt-get install -y --no-install-recommends apt-transport-https ca-certificates gnupg curl
12+
13+
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | gpg --dearmor -o /usr/share/keyrings/cloud.google.gpg
14+
15+
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
16+
17+
apt-get update
18+
if [ "${VERSION}" = "latest" ]; then
19+
apt-get install -y --no-install-recommends google-cloud-cli
20+
else
21+
apt-get install -y --no-install-recommends google-cloud-cli=${VERSION}-0
22+
fi
23+
24+
apt-get clean
25+
rm -rf /var/lib/apt/lists/*
26+
elif [ -f /etc/alpine-release ]; then
27+
apk add --no-cache curl ca-certificates bash python3
28+
# Standalone installation for Alpine
29+
curl -O https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-412.0.0-linux-x86_64.tar.gz
30+
tar -xf google-cloud-sdk-412.0.0-linux-x86_64.tar.gz
31+
./google-cloud-sdk/install.sh --quiet --path-update true
32+
mv google-cloud-sdk /usr/local/share/
33+
ln -s /usr/local/share/google-cloud-sdk/bin/gcloud /usr/local/bin/gcloud
34+
rm google-cloud-sdk-412.0.0-linux-x86_64.tar.gz
35+
else
36+
echo "Unsupported distribution"
37+
exit 1
38+
fi
39+
40+
echo "GCloud CLI installed successfully!"
41+
gcloud --version
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"id": "pulumi",
3+
"version": "1.0.0",
4+
"name": "Pulumi",
5+
"description": "Installs the Pulumi CLI via official installation script",
6+
"options": {
7+
"version": {
8+
"type": "string",
9+
"description": "Pulumi version (latest, or specific version)",
10+
"default": "latest"
11+
}
12+
},
13+
"installsAfter": [
14+
"ghcr.io/duizendstra/devcontainer-features/antigravity-nix"
15+
]
16+
}

src/features/pulumi/install.sh

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
VERSION=${VERSION:-"latest"}
5+
6+
echo "=== Pulumi Feature ==="
7+
echo "Target version: ${VERSION}"
8+
9+
# Install dependencies if needed
10+
if [ -f /etc/debian_version ]; then
11+
apt-get update
12+
apt-get install -y --no-install-recommends curl ca-certificates
13+
elif [ -f /etc/alpine-release ]; then
14+
apk add --no-cache curl ca-certificates bash
15+
fi
16+
17+
# Pulumi installation script
18+
# We'll use a temporary directory to avoid issues with $HOME in some container environments
19+
export PULUMI_HOME="/tmp/pulumi"
20+
mkdir -p "${PULUMI_HOME}"
21+
22+
if [ "${VERSION}" = "latest" ]; then
23+
curl -fsSL https://get.pulumi.com | sh -s -- --install-root "${PULUMI_HOME}"
24+
else
25+
curl -fsSL https://get.pulumi.com | sh -s -- --version "${VERSION}" --install-root "${PULUMI_HOME}"
26+
fi
27+
28+
# Move binaries to /usr/local/bin so they are in the PATH for all users
29+
if [ -d "${PULUMI_HOME}/.pulumi/bin" ]; then
30+
mv "${PULUMI_HOME}/.pulumi/bin/"* /usr/local/bin/
31+
rm -rf "${PULUMI_HOME}"
32+
fi
33+
34+
# Clean up apt lists if on Debian
35+
if [ -f /etc/debian_version ]; then
36+
rm -rf /var/lib/apt/lists/*
37+
fi
38+
39+
echo "Pulumi installed successfully!"
40+
pulumi version

test/features/gcloud/test.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# Import test library for `check` command
5+
source dev-container-features-test-lib
6+
7+
check "version" gcloud version
8+
9+
# Report results
10+
reportResults

test/features/pulumi/test.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# Import test library for `check` command
5+
source dev-container-features-test-lib
6+
7+
check "version" pulumi version
8+
9+
# Report results
10+
reportResults

0 commit comments

Comments
 (0)