Skip to content

Switch the Slack bot's release image to a hardened base #1085

Closed

Description

@kantord

Context

The Slack bot example (sdk/typescript/examples/slack-bot) now ships a real, CI-published, signed container image (ghcr.io/stacklok/mecatl/slack-bot, added in #1054). Its docker/bot.Dockerfile still builds on plain node:24-slim — not a hardened base. Raised by Samuele during #1054's review; deferred deliberately rather than done in that PR. Full reasoning is already written as a comment directly above the FROM line in docker/bot.Dockerfile.

Why it's not a one-line fix

The build currently runs corepack enable / pnpm install / pnpm run build inside the final image. A hardened runtime tag (minimal, distroless-style) almost certainly has neither a shell nor a package manager, so this needs a real multi-stage rewrite:

  • Builder stage: a -dev/full variant (has the toolchain) — installs deps, builds dist/, prunes node_modules to production-only.
  • Runtime stage: the minimal hardened tag — COPY in just dist/ + the pruned node_modules, run node dist/index.js directly. No corepack/pnpm/shell needed at runtime at all.

Recommendation: Chainguard over Docker Hardened Images

  • cgr.dev/chainguard/node: free, no registry login to pull. This repo already depends on this vendor for every other released image — mecated/mecak8s/mecatui build on cgr.dev/chainguard/static (see .ko.yaml). Adopting it here is zero new vendor relationship, zero new CI credentials.
    • One wrinkle: only latest/latest-dev are pullable for free; a specific pinned version tag needs a Chainguard sales conversation. Workaround, already precedented in .ko.yaml: pin the digest of latest at build time, not the moving tag.
  • Docker Hardened Images (docker.com/products/hardened-images): also genuinely free (Apache 2.0, unpaywalled catalog) and has a Node.js image, but pulling from dhi.io requires docker login dhi.io even on the free tier — a new credential that would need to be provisioned and stored as a GitHub secret in this repo's CI. Their "change one line in your Dockerfile" pitch doesn't mention that.

Scope

  • Rewrite docker/bot.Dockerfile as multi-stage per above.
  • Verify the resulting image still runs correctly (Socket Mode connects, gRPC to a real/mock mecated works) — not just that it builds.
  • Update the CI comment/notes in .github/workflows/release.yml's publish-slack-bot job if the build context or Dockerfile path changes.

Not urgent, not blocking anything — tracked so it doesn't quietly disappear.

Activity

  1. added
    enhancement
    on Sep 4, 2026
  2. removed
    enhancement
    on Sep 7, 2026
  3. self-assigned this
    on Sep 7, 2026
  4. added a commit that references this issue on Oct 6, 2026
    473c050
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions