Skip to content

Commit e96a9b4

Browse files
rickstaaclaude
andcommitted
feat: let an example run the published image instead of building
The images CI publishes were reachable only by hand: every compose.yml builds from source and names no image, so there was nothing for a pull to land on. Adding `image:` to the base file looked like the fix but is a trap. Compose's default pull_policy fetches a remote-resolvable image when it is missing locally, even for a service with a build section, so a plain `up -d` on a clean checkout would silently run the published image instead of the contributor's code. `pull_policy: build` avoids that but makes `docker compose pull` skip the service, losing the point. An overlay keeps the base file building from source exactly as before and reaches the registry only when asked, matching how compose.onchain already layers on. CI now parses the merged pair too. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 1c9f7cb commit e96a9b4

6 files changed

Lines changed: 57 additions & 2 deletions

File tree

.github/workflows/lint.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,9 @@ jobs:
3232
example=${dir%/}
3333
[ -f "$example/compose.yml" ] || continue
3434
docker compose -f "$example/compose.yml" config --quiet || status=1
35+
if [ -f "$example/compose.image.yml" ]; then
36+
docker compose -f "$example/compose.yml" \
37+
-f "$example/compose.image.yml" config --quiet || status=1
38+
fi
3539
done
3640
exit $status

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,15 @@ The orchestrator and signer services are defined once at the repo root and pulle
129129

130130
Each example ships a `Dockerfile` and a `compose.yml` that builds it locally. Those with a `Dockerfile` are also published to the GitHub Container Registry as `ghcr.io/livepeer/runner-example-<name>` (`linux/amd64`), linked from the example's own README. Tags: `latest` (current `main`), `stable` (latest `v*` release), `1.2` / `1.2.3`, `sha-<short>`.
131131

132-
The packages are public, so pulling one needs no account and no login:
132+
The packages are public, so pulling needs no account and no login. Each example with a `Dockerfile` ships a `compose.image.yml` overlay that swaps the local build for the published image:
133133

134134
```sh
135-
docker pull ghcr.io/livepeer/runner-example-hello-world:latest
135+
cd hello-world
136+
docker compose -f compose.yml -f compose.image.yml up -d
136137
```
137138

139+
The base `compose.yml` always builds from source, so the registry is reached only when you ask for it by adding the overlay. It stacks with the on-chain one (`-f compose.yml -f compose.onchain.yml -f compose.image.yml`).
140+
138141
> [!NOTE]
139142
> The images previously published under `rickstaa/` on Docker Hub are frozen; use the GHCR ones.
140143

echo/compose.image.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Run the published image instead of building. Layer it on the offchain base:
2+
# docker compose -f compose.yml -f compose.image.yml up -d
3+
#
4+
# The base file always builds from source, so this overlay is the only way to
5+
# reach the registry; `pull_policy: always` keeps a stale local copy from
6+
# shadowing the published one. Stacks with the on-chain overlay too:
7+
# docker compose -f compose.yml -f compose.onchain.yml -f compose.image.yml up -d
8+
9+
services:
10+
app:
11+
image: ghcr.io/livepeer/runner-example-echo:latest
12+
pull_policy: always

hello-world/compose.image.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Run the published image instead of building. Layer it on the offchain base:
2+
# docker compose -f compose.yml -f compose.image.yml up -d
3+
#
4+
# The base file always builds from source, so this overlay is the only way to
5+
# reach the registry; `pull_policy: always` keeps a stale local copy from
6+
# shadowing the published one. Stacks with the on-chain overlay too:
7+
# docker compose -f compose.yml -f compose.onchain.yml -f compose.image.yml up -d
8+
9+
services:
10+
app:
11+
image: ghcr.io/livepeer/runner-example-hello-world:latest
12+
pull_policy: always
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Run the published image instead of building. Layer it on the offchain base:
2+
# docker compose -f compose.yml -f compose.image.yml up -d
3+
#
4+
# The base file always builds from source, so this overlay is the only way to
5+
# reach the registry; `pull_policy: always` keeps a stale local copy from
6+
# shadowing the published one. Stacks with the on-chain overlay too:
7+
# docker compose -f compose.yml -f compose.onchain.yml -f compose.image.yml up -d
8+
9+
services:
10+
app:
11+
image: ghcr.io/livepeer/runner-example-realtime-transcription:latest
12+
pull_policy: always

tiles/compose.image.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Run the published image instead of building. Layer it on the offchain base:
2+
# docker compose -f compose.yml -f compose.image.yml up -d
3+
#
4+
# The base file always builds from source, so this overlay is the only way to
5+
# reach the registry; `pull_policy: always` keeps a stale local copy from
6+
# shadowing the published one. Stacks with the on-chain overlay too:
7+
# docker compose -f compose.yml -f compose.onchain.yml -f compose.image.yml up -d
8+
9+
services:
10+
app:
11+
image: ghcr.io/livepeer/runner-example-tiles:latest
12+
pull_policy: always

0 commit comments

Comments
 (0)