Skip to content

Commit c6b91a3

Browse files
vzakaznikovclaude
andcommitted
Publish testflows/machine-examples to Docker Hub
- Dockerfile builds every program with make check, which refuses a binary that is not static x86_64, and copies them into an empty image at /examples/<name>, with LICENSE. linux/amd64 only: a machine is x86_64. hello-world is the entrypoint. - .github/workflows/image.yml, run by hand, pushes :<YYYYMMDD-HHMM> and :latest, then runs the pushed image to check it. - README: building the image yourself. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BJu3r5JhoqtUHitojYU7xh
1 parent 0aaae0a commit c6b91a3

4 files changed

Lines changed: 110 additions & 0 deletions

File tree

‎.dockerignore‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.git
2+
bin
3+
compose

‎.github/workflows/image.yml‎

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Copyright 2026 Katteli Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# Builds testflows/machine-examples and pushes it to Docker Hub as
16+
# :<YYYYMMDD-HHMM> and :latest. Run by hand: a new image is a release.
17+
name: 🐳 Publish image
18+
19+
on:
20+
workflow_dispatch:
21+
22+
permissions:
23+
contents: read
24+
25+
env:
26+
IMAGE: testflows/machine-examples
27+
28+
jobs:
29+
publish:
30+
runs-on: ubuntu-latest
31+
steps:
32+
- uses: actions/checkout@v4
33+
34+
- name: Version
35+
id: version
36+
run: echo "version=$(date -u +%Y%m%d-%H%M)" >> "$GITHUB_OUTPUT"
37+
38+
- uses: docker/setup-buildx-action@v3
39+
40+
- uses: docker/login-action@v3
41+
with:
42+
username: ${{ secrets.DOCKERHUB_USERNAME }}
43+
password: ${{ secrets.DOCKERHUB_TOKEN }}
44+
45+
- uses: docker/build-push-action@v6
46+
with:
47+
context: .
48+
platforms: linux/amd64
49+
build-args: VERSION=${{ steps.version.outputs.version }}
50+
push: true
51+
tags: |
52+
${{ env.IMAGE }}:${{ steps.version.outputs.version }}
53+
${{ env.IMAGE }}:latest
54+
55+
- name: Check the pushed image
56+
run: |
57+
docker run --rm --platform linux/amd64 "$IMAGE:${{ steps.version.outputs.version }}" | grep -q "Hello from TestFlows Machine"
58+
echo "### Published $IMAGE:${{ steps.version.outputs.version }} and :latest" >> "$GITHUB_STEP_SUMMARY"

‎Dockerfile‎

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Copyright 2026 Katteli Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# The testflows/machine-examples image: every program, static, at
16+
# /examples/<name>. A machine is x86_64, so the image is linux/amd64 only.
17+
FROM --platform=linux/amd64 debian:bookworm-slim AS build
18+
RUN apt-get update \
19+
&& apt-get install -y --no-install-recommends gcc libc6-dev make file \
20+
&& rm -rf /var/lib/apt/lists/*
21+
WORKDIR /src
22+
COPY Makefile ./
23+
COPY hello hello
24+
COPY races races
25+
COPY starvation starvation
26+
COPY stress stress
27+
RUN make check
28+
29+
# Nothing but the programs: they are static, so they need no libraries, and
30+
# a disk built from this image carries only what it runs.
31+
FROM scratch
32+
ARG VERSION=dev
33+
LABEL org.opencontainers.image.title="TestFlows Machine examples" \
34+
org.opencontainers.image.description="Programs to run on TestFlows Machine" \
35+
org.opencontainers.image.url="https://testflows.com/machine/" \
36+
org.opencontainers.image.source="https://github.com/testflows/Machine-Examples" \
37+
org.opencontainers.image.licenses="Apache-2.0" \
38+
org.opencontainers.image.vendor="Katteli Inc." \
39+
org.opencontainers.image.version="${VERSION}"
40+
COPY --from=build /src/bin/ /examples/
41+
COPY LICENSE /LICENSE
42+
ENTRYPOINT ["/examples/hello-world"]

‎README.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,13 @@ machine disks build --binary bin/data-race race -- 8
6262
machine create --disk race
6363
```
6464

65+
Or build the image itself, the same one `testflows/machine-examples` is:
66+
67+
```bash
68+
docker build -t machine-examples .
69+
machine disks build --image machine-examples --entrypoint /examples/data-race race -- 8
70+
```
71+
6572
## 🐳 Compose Environments
6673

6774
`compose/` holds whole environments rather than programs: a docker compose

0 commit comments

Comments
 (0)