hammerkit

Installation

Install hammerkit, write a build file and run your first cached task.

Tasks that declare an image run in a container, so you also need a running container engine such as Docker. Check it with docker info.

Install hammerkit

npm install --global hammerkit

Describe a task

Create a .hammerkit.yaml next to your code. A task names the image it runs in, the files it reads (src) and its commands:

.hammerkit.yaml
tasks:
  hello:
    image: alpine:3.21
    src: [hello.txt]
    cmds:
      - cat hello.txt
echo "It's hammer time" > hello.txt

Run it

hammerkit hello
task: hello - It's hammer time
Summary:
  hello  executed   2.3s
  1 executed, 0 cached (0% cache hit), 2.3s total

Run it again

Nothing in src changed, so hammerkit reuses the result instead of running the task:

Summary:
  hello  cached     0ms
  0 executed, 1 cached (100% cache hit), 11ms total

Change hello.txt and it runs again. That's the whole idea — caching explains what counts as an input.

In CI

The container image contains hammerkit and can be used with Docker-in-Docker (dind) — the usual approach for container builds on CI systems.

The no0dles/hammerkit-github-action action installs hammerkit; it needs actions/setup-node first.

.github/workflows/ci.yml
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: '24'
      - uses: no0dles/hammerkit-github-action@v1.3
      - run: hammerkit build

To reuse results between CI runs and machines, see caching strategy in CI.

Next steps

On this page