|
| 1 | +# Devcontainer |
| 2 | + |
| 3 | +Adapted from [trailofbits/devcontainer-setup](https://skills.sh/trailofbits/skills/devcontainer-setup). |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +The devcontainer uses `ghcr.io/flathub-infra/flatpak-github-actions:gnome-49` — the same |
| 8 | +image CI uses for `compile-oci`. This gives full local/CI parity: same tools, same runtime, |
| 9 | +same `flatpak-builder` version. |
| 10 | + |
| 11 | +**Open in VS Code:** "Reopen in Container" |
| 12 | +**CLI helper:** `.devcontainer/install.sh self-install` → adds `devc` command to PATH |
| 13 | + |
| 14 | +## Key design decisions |
| 15 | + |
| 16 | +| Decision | Reason | |
| 17 | +|---|---| |
| 18 | +| Same gnome-49 image as CI | Local/CI parity; no drift | |
| 19 | +| `SOURCE_DATE_EPOCH=0` in containerEnv | Deterministic builds match CI | |
| 20 | +| `postCreateCommand` installs just + yq | These are not in base image; versions pinned to match CI | |
| 21 | +| No Dockerfile | Base image is immutable infra-managed; avoid drift by not layering | |
| 22 | +| `.flatpak-builder/` not in a volume | It lives in the workspace (bind mount) so it persists naturally | |
| 23 | + |
| 24 | +## Persistent volumes (from Trail of Bits pattern) |
| 25 | + |
| 26 | +Named volumes survive container rebuilds. Format: |
| 27 | + |
| 28 | +```json |
| 29 | +"mounts": [ |
| 30 | + "source={{PROJECT_SLUG}}-<purpose>-${devcontainerId},target=<path>,type=volume" |
| 31 | +] |
| 32 | +``` |
| 33 | + |
| 34 | +Currently no extra volumes are needed — workspace bind mount covers `.flatpak-builder/` |
| 35 | +cache and OSTree repos. Add volumes if any of these move outside the workspace. |
| 36 | + |
| 37 | +## Local build workflow |
| 38 | + |
| 39 | +```bash |
| 40 | +# Build one app locally (same as CI compile-oci, no ghcr.io push) |
| 41 | +just loop <app> |
| 42 | + |
| 43 | +# Build all apps locally |
| 44 | +just loop-all |
| 45 | + |
| 46 | +# Run full build + push to ghcr.io (requires GITHUB_TOKEN with packages:write) |
| 47 | +just build <app> |
| 48 | +``` |
| 49 | + |
| 50 | +## Adding new tools to the devcontainer |
| 51 | + |
| 52 | +1. If the tool has a `just install-tools-*` recipe, add it to `postCreateCommand` |
| 53 | +2. If not, add an `apt-get install` or `curl` step — do NOT modify the base image |
| 54 | +3. Pin versions to match CI (check `.github/workflows/build.yml`) |
| 55 | + |
| 56 | +## `devcontainers/ci` in CI (future work) |
| 57 | + |
| 58 | +The goal is to replace the bare `container:` stanza in `compile-oci` with |
| 59 | +`devcontainers/ci@v0.3` so this `devcontainer.json` becomes the single source of truth. |
| 60 | + |
| 61 | +**Blocker:** `flatpak/flatpak-github-actions/flatpak-builder@v6` is a GitHub Action that |
| 62 | +cannot be called from inside `devcontainers/ci`'s `runCmd`. Migration requires replacing |
| 63 | +it with direct `flatpak-builder` commands + manual ccache wiring in a Justfile recipe. |
| 64 | + |
| 65 | +See `skills/pipeline.md` → "devcontainers/ci for compile-oci (future work)" for the |
| 66 | +full migration plan. |
0 commit comments