Skip to content

Commit c53a9c8

Browse files
committed
feat: add workflow to publish templates to ghcr.io
Templates will be available in VS Code via: F1 → Dev Containers: Add Dev Container Configuration Files...
1 parent 969a0ec commit c53a9c8

2 files changed

Lines changed: 69 additions & 4 deletions

File tree

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Publish Dev Container Templates
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- '.devcontainer/**/devcontainer-template.json'
9+
- '.github/workflows/publish-templates.yml'
10+
workflow_dispatch:
11+
12+
env:
13+
REGISTRY: ghcr.io
14+
15+
jobs:
16+
publish:
17+
runs-on: ubuntu-latest
18+
permissions:
19+
contents: read
20+
packages: write
21+
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
26+
- name: Setup Node.js
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: '20'
30+
31+
- name: Install devcontainer CLI
32+
run: npm install -g @devcontainers/cli
33+
34+
- name: Log in to Container Registry
35+
uses: docker/login-action@v3
36+
with:
37+
registry: ${{ env.REGISTRY }}
38+
username: ${{ github.actor }}
39+
password: ${{ secrets.GITHUB_TOKEN }}
40+
41+
- name: Publish templates
42+
run: |
43+
OWNER="${{ github.repository_owner }}"
44+
OWNER_LC=$(echo "$OWNER" | tr '[:upper:]' '[:lower:]')
45+
46+
# Find and publish all templates
47+
for template_dir in .devcontainer/*/; do
48+
if [[ -f "${template_dir}devcontainer-template.json" ]]; then
49+
template_name=$(basename "$template_dir")
50+
echo "Publishing template: $template_name"
51+
52+
devcontainer templates publish "$template_dir" \
53+
--registry "${{ env.REGISTRY }}" \
54+
--namespace "$OWNER_LC"
55+
fi
56+
done

README.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,15 @@ Dev Container templates with Claude Code pre-installed on Debian 13 (Trixie).
2020

2121
## Usage
2222

23-
### Option 1: Copy the devcontainer folder
23+
### Option 1: Use from VS Code (recommended)
24+
25+
1. Open any folder in VS Code
26+
2. Press `F1` → "Dev Containers: Add Dev Container Configuration Files..."
27+
3. Select "Show All Definitions..."
28+
4. Search for `ghcr.io/pikatsuto/claude-code`
29+
5. Choose your template (base or base-with-bmad)
30+
31+
### Option 2: Copy the devcontainer folder
2432

2533
Copy the desired template folder from `.devcontainer/` to your project:
2634

@@ -32,7 +40,7 @@ cp -r .devcontainer/base /your-project/.devcontainer
3240
cp -r .devcontainer/base-with-bmad /your-project/.devcontainer
3341
```
3442

35-
### Option 2: Use the image directly
43+
### Option 3: Use the image directly
3644

3745
Create a `.devcontainer/devcontainer.json` in your project:
3846

@@ -48,7 +56,7 @@ Create a `.devcontainer/devcontainer.json` in your project:
4856
}
4957
```
5058

51-
### Option 3: Extend the image
59+
### Option 4: Extend the image
5260

5361
Create your own Dockerfile based on this image:
5462

@@ -104,7 +112,8 @@ echo $GITHUB_TOKEN | docker login ghcr.io -u USERNAME --password-stdin
104112
│ └── devcontainer-template.json
105113
├── .github/
106114
│ └── workflows/
107-
│ └── build-container.yml
115+
│ ├── build-container.yml
116+
│ └── publish-templates.yml
108117
├── devcontainer-collection.json
109118
└── README.md
110119
```

0 commit comments

Comments
 (0)