Skip to content

Commit 5533388

Browse files
meysholdtona-agent
andcommitted
Add my-team-setup devcontainer feature with GHA publish workflow
- Installs Python3 with common packages (requests, numpy, pandas) - Adds 'Hello World!' to terminal prompt - GitHub Actions workflow publishes to ghcr.io Co-authored-by: Ona <[email protected]>
1 parent 28ac8ac commit 5533388

File tree

3 files changed

+78
-0
lines changed

3 files changed

+78
-0
lines changed

.github/workflows/publish.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Publish Dev Container Feature
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
jobs:
10+
publish:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: read
14+
packages: write
15+
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
20+
- name: Log in to GitHub Container Registry
21+
uses: docker/login-action@v3
22+
with:
23+
registry: ghcr.io
24+
username: ${{ github.actor }}
25+
password: ${{ secrets.GITHUB_TOKEN }}
26+
27+
- name: Publish Features
28+
uses: devcontainers/action@v1
29+
with:
30+
publish-features: true
31+
base-path-to-features: ./src
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"id": "my-team-setup",
3+
"version": "1.0.0",
4+
"name": "My Team Setup",
5+
"description": "Installs Python3 with common packages and adds 'Hello World!' to the terminal prompt",
6+
"options": {
7+
"packages": {
8+
"type": "string",
9+
"default": "requests numpy pandas",
10+
"description": "Space-separated list of Python packages to install"
11+
}
12+
},
13+
"installsAfter": [
14+
"ghcr.io/devcontainers/features/common-utils"
15+
]
16+
}

src/my-team-setup/install.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/bash
2+
set -e
3+
4+
PACKAGES="${PACKAGES:-requests numpy pandas}"
5+
6+
echo "Installing Python3..."
7+
apt-get update
8+
apt-get install -y python3 python3-pip python3-venv
9+
10+
echo "Installing Python packages: $PACKAGES"
11+
pip3 install --break-system-packages $PACKAGES
12+
13+
echo "Configuring terminal prompt with 'Hello World!'..."
14+
15+
# Add prompt customization to /etc/bash.bashrc for all users
16+
cat >> /etc/bash.bashrc << 'EOF'
17+
18+
# Added by my-team-setup devcontainer feature
19+
export PS1="Hello World! \$PS1"
20+
EOF
21+
22+
# Also add to /etc/zsh/zshrc if zsh is available
23+
if [ -d /etc/zsh ]; then
24+
cat >> /etc/zsh/zshrc << 'EOF'
25+
26+
# Added by my-team-setup devcontainer feature
27+
export PS1="Hello World! $PS1"
28+
EOF
29+
fi
30+
31+
echo "my-team-setup feature installed successfully!"

0 commit comments

Comments
 (0)