The open-source agent harness - the runtime layer that turns an LLM into a working agent.
Build release image on Chainguard node bases (#886)
Raman Tehlan0fe346a7cb09
diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex 1dcb94923..39d6bc652 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -10,14 +10,18 @@# - none pending + unpublished versions → pack (build/test) + Windows npx smoke# in parallel with the from-source image (image waits only on npm view of# @truefoundry/trueforge@version; skip image+chart if that version is already-# on npm). After the image is pushed, this workflow calls release-chart.yml-# with branch main, app_version, and image_tag. Helm does not wait on pack.+# on npm). The release image is built on the hardened node bases from the+# TrueFoundry private registry. Local and contributor builds stay on+# node:24-slim.+# After the image is pushed, this workflow calls release-chart.yml with+# branch main, app_version, and image_tag. Helm does not wait on pack.# Merge the Version Packages PR to publish. After Helm publish, release-chart.yml# tags charts/trueforge@<chartVersion> on the metadata commit.## Auth is GitHub OIDC (no NPM_TOKEN / PYPI_TOKEN). An `_authToken` in user `.npmrc`# disables pnpm's OIDC exchange, so the npm publish job must not set NPM_TOKEN /-# NODE_AUTH_TOKEN. id-token is granted only on the publish jobs.+# NODE_AUTH_TOKEN. id-token is granted on the publish jobs and on the image job+# (OIDC into the private registry to pull the hardened bases, and Cosign signing).name: Version or publish packageson:@@ -322,8 +326,12 @@ jobs:exit 1fi- build-image:- name: Build and push server image+ # Two images, same tag, different Artifactory repos. The public one keeps the+ # Dockerfile's public bases so it stays redistributable; the hardened one is+ # built from Chainguard bases whose licence forbids publishing them, so it+ # only goes to the private repo that TrueFoundry SaaS pulls from.+ build-image-public:+ name: Build and push public server imageif: needs.resolve-image.outputs.skip == 'false'needs: [resolve-image]uses: truefoundry/github-workflows-public/.github/workflows/build.yml@main@@ -344,10 +352,42 @@ jobs:artifactory_username: ${{ secrets.TRUEFORGE_ARTIFACTORY_USERNAME }}artifactory_password: ${{ secrets.TRUEFORGE_ARTIFACTORY_PASSWORD }}+ build-image-private:+ name: Build and push hardened server image+ if: needs.resolve-image.outputs.skip == 'false'+ needs: [resolve-image]+ uses: truefoundry/github-workflows-public/.github/workflows/build.yml@main+ permissions:+ id-token: write+ contents: read+ with:+ artifactory_registry_url: ${{ vars.TRUEFOUNDRY_ARTIFACTORY_REGISTRY_URL }}+ artifactory_repository_url: ${{ vars.TRUEFOUNDRY_ARTIFACTORY_PRIVATE_REPOSITORY }}+ image_artifact_name: trueforge+ image_tag: ${{ needs.resolve-image.outputs.image_tag }}+ image_context: .+ dockerfile_path: Dockerfile+ platforms: linux/amd64+ enable_jfrog: true+ enable_public_ecr: false+ # Pull-only credential for the devtest account that helm-charts mirrors the+ # hardened bases into; the image itself still goes to Artifactory.+ enable_private_ecr_pull: true+ private_ecr_pull_registry: 526077812922.dkr.ecr.us-east-1.amazonaws.com+ # Mirror targets from helm-charts scripts/sync-images/images.yaml. Unset+ # variables fall back to those tags; an empty build arg would break FROM.+ image_build_args: |+ BUILD_BASE_IMAGE=${{ vars.TRUEFORGE_NODE_BUILD_BASE_IMAGE || '526077812922.dkr.ecr.us-east-1.amazonaws.com/tfy-internal/node:24-dev' }}+ RUNTIME_BASE_IMAGE=${{ vars.TRUEFORGE_NODE_RUNTIME_BASE_IMAGE || '526077812922.dkr.ecr.us-east-1.amazonaws.com/tfy-internal/node:24' }}+ secrets:+ artifactory_username: ${{ secrets.TRUEFOUNDRY_ARTIFACTORY_PRIVATE_USERNAME }}+ artifactory_password: ${{ secrets.TRUEFOUNDRY_ARTIFACTORY_PRIVATE_PASSWORD }}+ private_ecr_pull_role_arn: ${{ secrets.AWS_DEVTEST_ECR_IAM_ROLE_ARN }}+release-chart:name: Publish Helm chartif: needs.resolve-image.outputs.skip == 'false'- needs: [resolve-image, build-image]+ needs: [resolve-image, build-image-public, build-image-private]uses: ./.github/workflows/release-chart.ymlpermissions:contents: writediff --git a/Dockerfile b/Dockerfileindex a126843d4..f364555db 100644--- a/Dockerfile+++ b/Dockerfile@@ -9,8 +9,19 @@# the download layer stays cached when only package.json / scripts change.# See https://pnpm.io/cli/fetch. BuildKit cache mounts are avoided so the same# file builds on Railway Metal (which requires a hardcoded service id in mount ids).+#+# Base images are build args so a local or contributor build stays on the public+# Docker Hub image. The release workflow overrides both with the hardened node+# images from the TrueFoundry private registry (builder: node:24-dev, runtime:+# node:24).++ARG BUILD_BASE_IMAGE=node:24-slim+ARG RUNTIME_BASE_IMAGE=node:24-slim-FROM node:24-slim AS base+FROM ${BUILD_BASE_IMAGE} AS base+# The hardened bases default to uid 65532. Package install must run as root.+# node:24-slim is already root.+USER rootENV PNPM_HOME=/pnpmENV PATH="$PNPM_HOME:$PATH"RUN corepack enable && pnpm config set store-dir /pnpm/store@@ -79,8 +90,13 @@ RUN pnpm install --frozen-lockfile --offline --prod --filter @truefoundry/truefo# ---------------------------------------------------------------------------# runner: minimal image with prod node_modules + built artifacts.+# Fresh FROM so a hardened runtime base does not keep the builder toolchain.+# The default matches the builder, so local builds stay on node:24-slim.# ----------------------------------------------------------------------------FROM base AS runner+FROM ${RUNTIME_BASE_IMAGE} AS runner++USER root+WORKDIR /appENV NODE_ENV=production \HOST=0.0.0.0@@ -105,11 +121,25 @@ COPY --from=frontend-builder /app/packages/frontend/dist ./packages/trueforge/diWORKDIR /app/packages/trueforge-RUN groupadd --gid 10001 trueforge \- && useradd --uid 10001 --gid trueforge trueforge+# Chart pods run as uid 10001. Debian has groupadd; the hardened base has+# BusyBox addgroup. Fail loudly if a future base has neither, rather than on a+# bare "not found".+RUN if [ -x /usr/sbin/groupadd ]; then \+ groupadd --gid 10001 trueforge \+ && useradd --uid 10001 --gid trueforge trueforge; \+ elif command -v addgroup >/dev/null 2>&1 && command -v adduser >/dev/null 2>&1; then \+ addgroup -g 10001 trueforge \+ && adduser -D -H -u 10001 -G trueforge trueforge; \+ else \+ echo "base image has neither groupadd nor addgroup; cannot create uid 10001" >&2; \+ exit 1; \+ fiEXPOSE 8790-# Launch-only (matches root `pnpm start` / `standalone:start`). Image already contains dist.USER 10001:10001+# The hardened base sets ENTRYPOINT to the node binary, the Docker Hub base to+# docker-entrypoint.sh. Clear it so CMD is the whole command on both, and a+# `command:` override stays a command rather than arguments to node.+ENTRYPOINT []CMD ["node", "dist/main.js"]