DEV Community

Cover image for How I Cut Docker Build Time in Half Using Savepoints — And Built a CLI Tool in Go
Nour Mohamed Amine
Nour Mohamed Amine

Posted on

How I Cut Docker Build Time in Half Using Savepoints — And Built a CLI Tool in Go

“Do I really have to rebuild from scratch… again?”

That was the thought that finally pushed me over the edge.


🚨 The Problem: Rebuilding the Unchanged

If you’ve ever worked with a long Dockerfile in CI/CD, you know this pain:

  • You touch a line at the bottom
  • Docker cache misses (because the base layers are invalidated)
  • CI rebuilds everything — apt update, npm ci, go mod download... the works
  1. ⏱️ Time wasted.
  2. 💰 Resources burned.
  3. ⚠️ Productivity gone.

Caching helps, but it's finicky across CI environments and can break easily.

What I wanted was intentional, semantic checkpoints in my Dockerfile.


💡 The Idea: Savepoints as Named Build Layers

So I built Dockpoint — a CLI that turns your Dockerfile into an intelligent, incrementally buildable script.

With Dockpoint, you annotate your Dockerfile like this:

# savepoint: base
FROM node:20

# savepoint: deps
COPY package*.json ./
RUN npm ci

# savepoint: app
COPY . .
CMD ["node", "index.js"]
Enter fullscreen mode Exit fullscreen mode

Each # savepoint: name becomes a named layer that Dockpoint can build, tag, reuse, or skip in CI pipelines.


🔧 Want to build only up to the deps step?

dockpoint build-savepoint deps -t docker.io/your/app:deps
Enter fullscreen mode Exit fullscreen mode

📦 Want to build all steps and push them as incremental images?

dockpoint build-savepoint -t docker.io/your/app:1.0.0 --push
Enter fullscreen mode Exit fullscreen mode

✨ The Magic: Content-Based Tagging (Using Hashing)

Dockpoint doesn’t rely on Docker’s fragile cache alone.

It hashes the Dockerfile lines used for each savepoint and creates a tag like:

docker.io/your/app:deps-14f95d20
Enter fullscreen mode Exit fullscreen mode

This means:

  • If your deps block changes → new tag
  • If it hasn’t changed → Dockpoint skips building and reuses the layer

✅ Your CI/CD becomes fast, predictable, and cache-safe


🛠️ The Architecture (A Clean Go CLI)

Yes — I built this in Go (my first Go project).

Dockpoint is written using:

  • 🧼 Clean Architecture (application, domain, infrastructure)
  • 🐍 Cobra for CLI
  • 📦 GoReleaser for packaging (multi-arch, Homebrew-ready)
  • 🤖 GitHub Actions for CI
  • 📊 Codecov for coverage tracking

🚀 One Command. Smart Layers.

Dockpoint gives you a smarter docker build:

dockpoint build-savepoint app -t docker.io/you/app:1.0.0
Enter fullscreen mode Exit fullscreen mode
  • Tags each savepoint with its hash
  • Pushes final image cleanly
  • Reuses existing layers when possible
  • Speeds up your pipeline

🎯 Why I Built This (And Why You Might Need It)

This started with a single itch:

“Why are we rebuilding what didn’t change?”

Now Dockpoint has:

  • ✅ Deterministic layer tagging
  • 🔍 Savepoint validation
  • 🌐 Cross-platform support
  • 🧪 A clean, tested CLI written from scratch

If you’re tired of Dockerfiles being dumb scripts with no structure,

Dockpoint gives you structure — without changing Docker at all.


📥 Try Dockpoint

Check it out:


🧪 Install

# Homebrew (coming soon)
brew install zeflq/tap/dockpoint

# Or use GitHub Releases
curl -Lo dockpoint https://github.com/zeflq/dockpoint/releases/latest/download/dockpoint_linux_amd64.tar.gz
tar -xzf dockpoint_linux_amd64.tar.gz
chmod +x dockpoint
./dockpoint --help
Enter fullscreen mode Exit fullscreen mode

❤️ Final Thought

This is my first Go project — and it made me fall in love with the language.

It’s fast, easy to compile, cross-platform, and perfect for tools like this.

If Dockpoint saves you even one build cycle, it’s worth it.

And if you want to help me polish v1.1PRs are welcome!

Top comments (2)

Collapse
 
nevodavid profile image
Nevo David

been through that docker pain myself way too many times tbh - respect for just freaking building your own fix instead of waiting around

Collapse
 
zeflq profile image
Nour Mohamed Amine

Haha I feel you — it’s that exact frustration that pushed me over the edge! 😅
Appreciate the support — building Dockpoint was my way of saying “enough is enough” to wasted CI hours. Hope it helps others escape the same cycle!