Skip to content

Commit c247b8a

Browse files
ci: build harness-server from examples/Dockerfile.harness via ENTRY arg
The previous workflow pointed the harness-server matrix entry at `deploy/fullstack-base/harness-server.Dockerfile` which only exists in the enterprise-computeragent repo. CI failed with `resolve : lstat deploy: no such file or directory`. Fix: make examples/Dockerfile.harness parametric via an ENTRY build arg. Same image layers; CMD picks between examples/harness-server.ts (bare /v1/sessions route) and examples/computeragent-server.ts (full /run + /sandboxes + /tasks). The CI matrix and build-and-push.sh now pass --build-arg ENTRY=... per image.
1 parent 02dab13 commit c247b8a

3 files changed

Lines changed: 47 additions & 9 deletions

File tree

.github/workflows/build-images.yml

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,16 @@ jobs:
4444
fail-fast: false
4545
matrix:
4646
include:
47+
# The two harness images share examples/Dockerfile.harness — only
48+
# the entry script differs (ENTRY build arg).
4749
- name: harness-server
48-
dockerfile: deploy/fullstack-base/harness-server.Dockerfile
49-
build_args: ""
50+
dockerfile: examples/Dockerfile.harness
51+
entry: examples/harness-server.ts
52+
build_args: harness
5053
- name: computeragent-server
5154
dockerfile: examples/Dockerfile.harness
52-
build_args: ""
55+
entry: examples/computeragent-server.ts
56+
build_args: harness
5357
- name: agentos-server
5458
dockerfile: packages/agentos-server/Dockerfile
5559
build_args: ""
@@ -100,8 +104,8 @@ jobs:
100104
fi
101105
echo "tags=${TAGS}" >> "$GITHUB_OUTPUT"
102106
103-
- name: Build and push ${{ matrix.name }} (non-SPA)
104-
if: matrix.build_args != 'spa'
107+
- name: Build and push ${{ matrix.name }} (agentos-server)
108+
if: matrix.build_args == ''
105109
uses: docker/build-push-action@v5
106110
with:
107111
context: .
@@ -111,6 +115,19 @@ jobs:
111115
cache-from: type=gha,scope=${{ matrix.name }}
112116
cache-to: type=gha,mode=max,scope=${{ matrix.name }}
113117

118+
- name: Build and push ${{ matrix.name }} (harness variant)
119+
if: matrix.build_args == 'harness'
120+
uses: docker/build-push-action@v5
121+
with:
122+
context: .
123+
file: ${{ matrix.dockerfile }}
124+
push: ${{ github.event_name != 'pull_request' }}
125+
tags: ${{ steps.tags.outputs.tags }}
126+
build-args: |
127+
ENTRY=${{ matrix.entry }}
128+
cache-from: type=gha,scope=${{ matrix.name }}
129+
cache-to: type=gha,mode=max,scope=${{ matrix.name }}
130+
114131
- name: Build and push agentos-spa (with VITE_ build args)
115132
if: matrix.build_args == 'spa'
116133
uses: docker/build-push-action@v5

examples/Dockerfile.harness

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
1-
# ComputerAgent harness — runs examples/computeragent-server.ts via bun.
1+
# ComputerAgent harness — runs one of the example server entries via bun.
2+
#
3+
# Defaults to examples/computeragent-server.ts (full harness: /run + /sandboxes
4+
# + /tasks + /snapshots, port 8787).
5+
#
6+
# Override the entry to build the BARE harness instead (just /v1/sessions/*
7+
# on port 7700), used by the Python qa-worker:
8+
# docker build -f examples/Dockerfile.harness \
9+
# --build-arg ENTRY=examples/harness-server.ts \
10+
# -t harness-server .
11+
#
12+
# Same image layers in both cases — only the CMD differs.
213
#
314
# Build from the REPO ROOT so pnpm workspace resolution works:
415
# docker build -f examples/Dockerfile.harness -t computeragent-harness .
@@ -50,4 +61,11 @@ EXPOSE 8787
5061
# handles this).
5162
VOLUME ["/tmp/computeragent-sessions"]
5263

53-
CMD ["bun", "run", "examples/computeragent-server.ts"]
64+
# Entry script — override at build time for the bare harness variant:
65+
# --build-arg ENTRY=examples/harness-server.ts
66+
ARG ENTRY=examples/computeragent-server.ts
67+
ENV ENTRY=${ENTRY}
68+
69+
# Shell form so $ENTRY is expanded at runtime by /bin/sh; `exec` keeps bun
70+
# as PID 1 (signals + Docker stop semantics still work).
71+
CMD exec bun run "$ENTRY"

scripts/build-and-push.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,14 @@ IFS=',' read -ra TARGETS <<< "${IMAGES}"
7878
for img in "${TARGETS[@]}"; do
7979
case "${img}" in
8080
harness-server)
81+
# Bare harness — same Dockerfile, ENTRY override to harness-server.ts.
8182
build_one harness-server \
82-
"${REPO_ROOT}/deploy/fullstack-base/harness-server.Dockerfile" \
83-
"${REPO_ROOT}"
83+
"${REPO_ROOT}/examples/Dockerfile.harness" \
84+
"${REPO_ROOT}" \
85+
--build-arg "ENTRY=examples/harness-server.ts"
8486
;;
8587
computeragent-server)
88+
# Default ENTRY in the Dockerfile already points at computeragent-server.ts.
8689
build_one computeragent-server \
8790
"${REPO_ROOT}/examples/Dockerfile.harness" \
8891
"${REPO_ROOT}"

0 commit comments

Comments
 (0)