Skip to content

Commit 4dbb44c

Browse files
henrypark133claude
andauthored
fix(docker): make runtime-staging the default Docker target for Railway (#2244)
* fix(docker): make runtime-staging the default Docker target for Railway Railway's railway.toml doesn't support a `target` field — it was being silently ignored, so the wasm-builder stage never ran and WASM extensions were never pre-bundled. Fix by reordering Dockerfile stages so runtime-staging is last (= default target). Railway builds the default target, so it now gets WASM extensions. CI is unaffected — it uses explicit --target flags in docker.yml. Also reverts the CACHE_BUST arg added in efdb738 (no longer needed) and removes the unsupported `target` field from railway.toml. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix(ci): add --target runtime to CI and local docker build commands Copilot correctly flagged that test.yml's `docker build .` would now build the wasm-builder stage (slow, flaky) since runtime-staging is the default target. Add explicit --target runtime to CI and update the Dockerfile header comment for local builds. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * perf(docker): decouple wasm-builder from builder stage wasm-builder now inherits from chef instead of builder, so WASM extensions only rebuild when tools-src/, channels-src/, registry/, or wit/ change — not on every src/ edit. The extensions are standalone crates with their own lockfiles and don't depend on the main workspace. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 160a75e commit 4dbb44c

3 files changed

Lines changed: 19 additions & 11 deletions

File tree

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ jobs:
194194
ref: ${{ inputs.ref || github.sha }}
195195
persist-credentials: false
196196
- name: Build Docker image
197-
run: docker build -t ironclaw-test:ci .
197+
run: docker build --target runtime -t ironclaw-test:ci .
198198

199199
version-check:
200200
name: Version Bump Check

Dockerfile

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# database reopen), so we use glibc.
99
#
1010
# Build:
11-
# docker build --platform linux/amd64 -t ironclaw:latest .
11+
# docker build --platform linux/amd64 --target runtime -t ironclaw:latest .
1212
#
1313
# Run:
1414
# docker run --env-file .env -p 3000:3000 ironclaw:latest
@@ -68,11 +68,18 @@ COPY profiles/ profiles/
6868
RUN cargo build --profile dist --bin ironclaw
6969

7070
# Stage 4b: Build all WASM extensions from source (only used by runtime-staging)
71-
FROM builder AS wasm-builder
72-
ARG CACHE_BUST
71+
#
72+
# Inherits from chef (not builder) so WASM extensions only rebuild when
73+
# tools-src/, channels-src/, registry/, or wit/ change — not on every
74+
# src/ edit. The extensions are standalone crates with their own lockfiles.
75+
FROM chef AS wasm-builder
7376

7477
RUN apt-get update && apt-get install -y --no-install-recommends jq && rm -rf /var/lib/apt/lists/*
75-
RUN echo "cache-bust=${CACHE_BUST}"
78+
79+
COPY tools-src/ tools-src/
80+
COPY channels-src/ channels-src/
81+
COPY registry/ registry/
82+
COPY wit/ wit/
7683

7784
RUN set -eux; \
7885
mkdir -p /app/wasm-bundles/tools /app/wasm-bundles/channels; \
@@ -134,12 +141,14 @@ ENV RUST_LOG=ironclaw=info
134141

135142
ENTRYPOINT ["ironclaw"]
136143

137-
# Stage 5b: Staging runtime (with pre-built WASM extensions)
144+
# Stage 5b: Production runtime (no pre-bundled extensions)
145+
FROM runtime-base AS runtime
146+
USER ironclaw
147+
148+
# Stage 5c: Staging runtime (with pre-built WASM extensions)
149+
# Last stage = default target. Railway doesn't support --target, so this
150+
# must be last for Railway deploys. CI uses explicit --target flags.
138151
FROM runtime-base AS runtime-staging
139152
COPY --from=wasm-builder --chown=ironclaw:ironclaw /app/wasm-bundles/tools/ /home/ironclaw/.ironclaw/tools/
140153
COPY --from=wasm-builder --chown=ironclaw:ironclaw /app/wasm-bundles/channels/ /home/ironclaw/.ironclaw/channels/
141154
USER ironclaw
142-
143-
# Stage 5c: Production runtime (default — no pre-bundled extensions)
144-
FROM runtime-base AS runtime
145-
USER ironclaw

railway.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
[build]
22
builder = "dockerfile"
33
dockerfilePath = "Dockerfile"
4-
target = "runtime-staging"
54

65
[deploy]
76
healthcheckPath = "/api/health"

0 commit comments

Comments
 (0)