Skip to content

Commit 799c95b

Browse files
committed
Default to local builds for template portability
Switch devcontainer.json from prebuilt GHCR image to local builds as the default. This ensures the template works out of the box for forks and new projects without depending on a pre-existing GHCR image. The prebuilt image is preserved as a commented-out option with instructions in the README for enabling it, including the requirement to make the GHCR package public (private by default).
1 parent 867454b commit 799c95b

File tree

2 files changed

+22
-30
lines changed

2 files changed

+22
-30
lines changed

.devcontainer/devcontainer.json

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,20 @@
11
{
22
"name": "python_template",
33

4-
// Prebuilt image from GHCR (built by .github/workflows/devcontainer.yml)
5-
// Features (including claude-code) are baked into this image.
6-
"image": "ghcr.io/blooop/python_template/devcontainer:latest",
4+
"build": {
5+
"dockerfile": "Dockerfile",
6+
"context": ".."
7+
},
8+
"features": {
9+
"./claude-code": {},
10+
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
11+
"ghcr.io/devcontainers/features/common-utils:2": {}
12+
},
713

8-
// To build locally instead of using the prebuilt image, comment out "image" above
9-
// and uncomment the "build" and "features" blocks below:
10-
// "build": {
11-
// "dockerfile": "Dockerfile",
12-
// "context": ".."
13-
// },
14-
// "features": {
15-
// "./claude-code": {},
16-
// "ghcr.io/devcontainers/features/docker-in-docker:2": {},
17-
// "ghcr.io/devcontainers/features/common-utils:2": {},
18-
// "ghcr.io/anthropics/devcontainer-features/claude-code:1.0": {},
19-
// "ghcr.io/jsburckhardt/devcontainer-features/codex:latest": {}
20-
// },
14+
// To use a prebuilt image instead of building locally (faster startup),
15+
// comment out "build" and "features" above, uncomment "image" below,
16+
// and ensure the GHCR package is public (see README).
17+
// "image": "ghcr.io/blooop/python_template/devcontainer:latest",
2118

2219
"initializeCommand": ".devcontainer/claude-code/init-host.sh",
2320
"customizations": {

README.md

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -57,21 +57,20 @@ source .claude/activate.sh
5757

5858
See [.claude/README.md](.claude/README.md) for detailed information about the Claude Code configuration.
5959

60-
# Devcontainer Prebuilt Image
60+
# Devcontainer
6161

62-
This template includes a CI workflow (`.github/workflows/devcontainer.yml`) that automatically builds and pushes a devcontainer image to GitHub Container Registry (GHCR) whenever `.devcontainer/` files change on `main`.
62+
By default, the devcontainer builds locally from `.devcontainer/Dockerfile`. This works out of the box for all users, including forks and projects created from this template.
6363

64-
The main `.devcontainer/devcontainer.json` references this prebuilt image to avoid slow local builds:
64+
## Switching to a prebuilt image (optional)
6565

66-
```json
67-
"image": "ghcr.io/blooop/python_template/devcontainer:latest"
68-
```
69-
70-
## GHCR Package Visibility
66+
A CI workflow (`.github/workflows/devcontainer.yml`) automatically builds and pushes a devcontainer image to GHCR whenever `.devcontainer/` files change on `main`. To use it for faster startup:
7167

72-
**GHCR packages are private by default.** After the first CI push, you must manually make the package public or users (and tools like DevPod) will get a `MANIFEST_UNKNOWN` error when trying to pull the image.
68+
1. Edit `.devcontainer/devcontainer.json`: comment out the `"build"` and `"features"` blocks, uncomment the `"image"` line
69+
2. Update the image reference to match your repo: `ghcr.io/<owner>/<repo>/devcontainer:latest`
70+
3. Push to `main` and wait for the CI workflow to complete
71+
4. **Make the GHCR package public** (see below) — GHCR packages are private by default and will fail with `MANIFEST_UNKNOWN` otherwise
7372

74-
### Making the package public
73+
### Making the GHCR package public
7574

7675
**Option 1: GitHub Web UI**
7776

@@ -90,10 +89,6 @@ gh auth refresh -s write:packages
9089
gh api --method PATCH /user/packages/container/<repo>%2Fdevcontainer -f visibility=public
9190
```
9291

93-
## Falling back to local builds
94-
95-
If the prebuilt image is unavailable, you can switch to local builds by editing `.devcontainer/devcontainer.json`: comment out the `"image"` line and uncomment the `"build"` and `"features"` blocks.
96-
9792
# Github setup
9893

9994
There are github workflows for CI, codecov and automated pypi publishing in `ci.yml` and `publish.yml`.

0 commit comments

Comments
 (0)