Skip to content

Commit 38b25c1

Browse files
jalagrangeclaude
andcommitted
fix: clean up Dockerfile.tpc and split CI into two jobs
- Remove invalid FROM stage that caused BASE_IMAGE to be blank - Split workflow into build-base and build-tpc jobs so the TPC image can pull the base from GHCR after it's pushed Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent c78fa6f commit 38b25c1

2 files changed

Lines changed: 39 additions & 33 deletions

File tree

.github/workflows/build-tpc.yml

Lines changed: 35 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@ env:
1717
TPC_IMAGE: ghcr.io/${{ github.repository }}-tpc
1818

1919
jobs:
20-
build:
20+
build-base:
2121
runs-on: ubuntu-latest
2222
permissions:
2323
contents: read
2424
packages: write
25+
outputs:
26+
tag: ${{ steps.version.outputs.tag }}
2527

2628
steps:
2729
- name: Checkout
@@ -46,36 +48,55 @@ jobs:
4648
echo "tag=dev-$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
4749
fi
4850
49-
# Step 1: Build base OpenClaw image from upstream Dockerfile
50-
- name: Build base OpenClaw image
51+
- name: Build and push base OpenClaw image
5152
uses: docker/build-push-action@v5
5253
with:
5354
context: .
5455
file: Dockerfile
55-
push: ${{ github.event_name == 'push' || inputs.push }}
56+
push: true
5657
tags: |
5758
${{ env.BASE_IMAGE }}:${{ steps.version.outputs.tag }}
5859
${{ env.BASE_IMAGE }}:latest
59-
cache-from: type=gha
60-
cache-to: type=gha,mode=max
60+
cache-from: type=gha,scope=base
61+
cache-to: type=gha,scope=base,mode=max
62+
63+
build-tpc:
64+
runs-on: ubuntu-latest
65+
needs: build-base
66+
permissions:
67+
contents: read
68+
packages: write
69+
70+
steps:
71+
- name: Checkout
72+
uses: actions/checkout@v4
73+
74+
- name: Set up Docker Buildx
75+
uses: docker/setup-buildx-action@v3
76+
77+
- name: Log in to GHCR
78+
uses: docker/login-action@v3
79+
with:
80+
registry: ${{ env.REGISTRY }}
81+
username: ${{ github.actor }}
82+
password: ${{ secrets.GITHUB_TOKEN }}
6183

62-
# Step 2: Build TPC-extended image on top
63-
- name: Build TPC OpenClaw image
84+
- name: Build and push TPC OpenClaw image
6485
uses: docker/build-push-action@v5
6586
with:
6687
context: .
6788
file: Dockerfile.tpc
6889
build-args: |
69-
BASE_IMAGE=${{ env.BASE_IMAGE }}:${{ steps.version.outputs.tag }}
90+
BASE_IMAGE=${{ env.BASE_IMAGE }}:${{ needs.build-base.outputs.tag }}
7091
push: ${{ github.event_name == 'push' || inputs.push }}
7192
tags: |
72-
${{ env.TPC_IMAGE }}:${{ steps.version.outputs.tag }}
93+
${{ env.TPC_IMAGE }}:${{ needs.build-base.outputs.tag }}
7394
${{ env.TPC_IMAGE }}:latest
74-
cache-from: type=gha
75-
cache-to: type=gha,mode=max
95+
cache-from: type=gha,scope=tpc
96+
cache-to: type=gha,scope=tpc,mode=max
7697

7798
- name: Summary
7899
run: |
79100
echo "### Built images" >> "$GITHUB_STEP_SUMMARY"
80-
echo "- Base: \`${{ env.BASE_IMAGE }}:${{ steps.version.outputs.tag }}\`" >> "$GITHUB_STEP_SUMMARY"
81-
echo "- TPC: \`${{ env.TPC_IMAGE }}:${{ steps.version.outputs.tag }}\`" >> "$GITHUB_STEP_SUMMARY"
101+
echo "- Base: \`${{ env.BASE_IMAGE }}:${{ needs.build-base.outputs.tag }}\`" >> "$GITHUB_STEP_SUMMARY"
102+
echo "- TPC: \`${{ env.TPC_IMAGE }}:${{ needs.build-base.outputs.tag }}\`" >> "$GITHUB_STEP_SUMMARY"

Dockerfile.tpc

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,16 @@
11
# TPC-specific OpenClaw image
22
#
3-
# Builds OpenClaw from source using the upstream multi-stage Dockerfile,
4-
# then adds agent-browser + Chromium for the Buyer Acquisition agent's
5-
# web research capability.
3+
# Extends the base OpenClaw image with agent-browser + Chromium for
4+
# the Buyer Acquisition agent's web research capability.
65
#
7-
# Build locally:
6+
# Build locally (after building base image):
7+
# docker build -t openclaw:local .
88
# docker build -f Dockerfile.tpc -t openclaw-tpc:local .
99
#
1010
# Build via CI:
1111
# Pushed automatically to ghcr.io/moonshot-partners/openclaw-tpc
1212
# on tag push (see .github/workflows/build-tpc.yml)
1313

14-
# --- Build OpenClaw from source using the upstream Dockerfile ---
15-
# This is equivalent to: docker build -t openclaw:local .
16-
# We use the upstream Dockerfile as a build stage.
17-
18-
FROM openclaw-base AS openclaw-build
19-
20-
# --- Extend with TPC customisations ---
21-
# We can't easily chain multi-stage Dockerfiles, so we use a simpler
22-
# approach: build the base image first, then extend it.
23-
#
24-
# In practice, the GitHub Actions workflow does:
25-
# 1. docker build -t openclaw:local . (upstream Dockerfile)
26-
# 2. docker build -f Dockerfile.tpc -t openclaw-tpc:local . (this file)
27-
28-
# Start from the locally-built OpenClaw image
2914
ARG BASE_IMAGE=openclaw:local
3015
FROM ${BASE_IMAGE}
3116

0 commit comments

Comments
 (0)