| 1 | FROM docker.io/oven/bun:1.4.4@sha256:3f23864d3e8c923975c61971cabe67ee3d5a728f1e25a559256b95af719a3478 AS build |
| 2 | WORKDIR /src |
| 3 | RUN apt-get update && apt-get install -y --no-install-recommends git && rm -rf /var/lib/apt/lists/* |
| 4 | ENV BUN_INSTALL=/opt/tools BUN_INSTALL_BIN=/opt/tools/bin |
| 5 | RUN bun install --global --trust @anthropic-ai/claude-code@2.1.318 @openai/codex@0.166.0 \ |
| 6 | && install -m 0755 /opt/tools/install/global/node_modules/@anthropic-ai/claude-code-linux-x64/claude /usr/local/bin/claude \ |
| 7 | && install -m 0755 /opt/tools/install/global/node_modules/@openai/codex-linux-x64/vendor/x86_64-unknown-linux-musl/bin/codex /usr/local/bin/codex \ |
| 8 | && claude --version && codex --version |
| 9 | RUN chown bun:bun /src |
| 10 | COPY --chown=bun:bun . . |
| 11 | USER bun |
| 12 | RUN bun install --frozen-lockfile --cache-dir /tmp/bun-cache |
| 13 | RUN bun fmt --no-script --check && bun run lint && bun run typecheck |
| 14 | # The updater's compilation test requires a checkout; immutable images contain source exports. |
| 15 | RUN sed -i '/^ "dashboard\/test-update.ts",$/d' tests.ts |
| 16 | RUN bun tests.ts |
| 17 | RUN bun build --compile --bytecode --sourcemap \ |
| 18 | --no-compile-autoload-dotenv --no-compile-autoload-bunfig --reject-unresolved \ |
| 19 | --define "SUBSTATION_COMMIT=$(bun -e 'console.log(JSON.stringify(require("./.snowglobe-source.json").sources[0].revision))')" \ |
| 20 | --define "SUBSTATION_VERSION=$(bun -e 'console.log(JSON.stringify(require("./.snowglobe-source.json").version))')" \ |
| 21 | --define "SUBSTATION_BUILT_AT=$(bun -e 'console.log(JSON.stringify(new Date().toISOString()))')" \ |
| 22 | substation.ts --outfile /tmp/substation |
| 23 | FROM docker.io/oven/bun:1.4.4@sha256:3f23864d3e8c923975c61971cabe67ee3d5a728f1e25a559256b95af719a3478 |
| 24 | COPY --from=build /tmp/substation /usr/local/bin/substation |
| 25 | COPY --from=build /usr/local/bin/claude /usr/local/bin/codex /usr/local/bin/ |
| 26 | RUN substation --version && claude --version && codex --version |
| 27 | ENTRYPOINT ["/usr/local/bin/substation"] |