StoicBuilder

HandbookX the PortusBuild artifacts

Xthe Portus, Ship it

Build artifacts

1 min readUpdated 28 November

In plain words

A build artifact is what a build produces, such as a compiled bundle, a Docker image or a zip file, stored under a version so the exact thing you tested is the thing you deploy.

Where you see it

Harbor's pipeline builds a Docker image once, tags it with the commit id, pushes it to a registry and deploys that same image to staging and then production. In GitHub Actions, files saved with actions/upload-artifact appear as downloads on the run's summary page.

Terminalterminal
docker build -t ghcr.io/harbor/web:9c1e0a7 .docker push ghcr.io/harbor/web:9c1e0a7# staging and production both run this exact tag
Tagging with the commit id ties every running copy back to the code that made it.

What goes wrong

  1. Rebuilding for each environment

    A second build from the same commit can pick up a newer base image or a different build setting, so what you tested isn't what you ship. Build once and promote the same artifact.

  2. Tagging everything latest

    latest moves every time you push, so you can't tell which code is running or go back to the image before it. Tag with the commit id or version and deploy that tag.

    docker push ghcr.io/harbor/web:latest
  3. Settings baked in at build time

    Next.js copies NEXT_PUBLIC_ variables into the browser bundle during next build, so an artifact built with staging's values shows staging's values in production. Read per-environment settings at runtime, or build per environment on purpose.

What to tell your agent

Copy this into Lovable, Bolt, Cursor or any agent
Change our pipeline to build the app once per commit, tag the artifact with the commit SHA, and deploy that same artifact to staging and then production. List every value that's fixed at build time, such as NEXT_PUBLIC_ variables, and tell me how each will differ between environments.

Quick check

Sign in to earn +10 XP for it

Staging passed every check, then production was rebuilt from the same commit and broke. What's the most likely cause?

Got a prompt that touches build artifacts?

Paste it. You get a better prompt first, then the cards that explain it.

Check your own prompt

Free, no sign-up.