# Toolshed container image (M0 spike — see common-cluster docs/implementation-plan.md) # # Build context must be the labs repo ROOT (workspace imports resolve from the # root deno.jsonc). Modeled on clusterduck's Dockerfile.worker labs-builder # stage, pinned to the Deno version tasks/check.sh requires. # # docker build -f Dockerfile.toolshed --build-arg COMMIT_SHA=$(git rev-parse HEAD) \ # -t us-central1-docker.pkg.dev/commontools-core/containers/toolshed:m0 . FROM denoland/deno:2.8.1 AS builder WORKDIR /build/labs COPY . . RUN deno install --frozen # Docker layers make Deno.rename a cross-device move; patch build-binaries to cp. RUN sed -i 's|await Deno\.rename(shellOut, toolshedShellFrontend);|await new Deno.Command("cp", { args: ["-r", shellOut, toolshedShellFrontend] }).output(); await Deno.remove(shellOut, { recursive: true });|g' tasks/build-binaries.ts ARG COMMIT_SHA RUN COMMIT_SHA=$COMMIT_SHA deno task build-binaries FROM denoland/deno:2.8.1 COPY --from=builder /build/labs/dist/toolshed /usr/local/bin/toolshed # Warm run: bakes the @db/sqlite FFI libsqlite3.so into the image's deno plug # cache so pods don't need github.com egress on first database open. RUN ENV=production CFTS_AI_GATEWAY_URL= DB_PATH=/tmp/warm.db timeout 15s toolshed || [ $? -eq 124 ] \ && rm -rf /tmp/warm.db* /tmp/cf-compilation-cache EXPOSE 8000 ENTRYPOINT ["toolshed"]