build: migrate from Dapper to single-Dockerfile build system#128
Conversation
There was a problem hiding this comment.
Pull request overview
This PR migrates the repository’s build workflow from a Dapper-driven model to a single root-level Dockerfile with per-target build stages, with Makefile targets orchestrating the workflow and enabling BuildKit caching.
Changes:
- Replaced Dapper-based Make targets with
docker build --target …stages (plus local--outputextraction where needed). - Added a root
Dockerfileimplementing build/test/validate/generate stages with BuildKit cache mounts. - Updated
scripts/versionto support.git-less builds via a pre-generatedscripts/.version_env, and removed Dapper entrypoint/orchestration scripts.
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
scripts/version |
Adds .git-availability guard and writes/loads scripts/.version_env for container builds. |
scripts/release |
Removed legacy Dapper release wrapper. |
scripts/entry |
Removed legacy Dapper entrypoint. |
scripts/default |
Removed legacy Dapper default orchestration. |
scripts/ci |
Removed legacy Dapper CI orchestration. |
Makefile |
New Dockerfile-stage driven build/test/validate/generate/package targets. |
Dockerfile.dapper |
Removed Dapper build image definition. |
Dockerfile |
New multi-stage build defining build/test/validate/generate targets and local outputs. |
.gitignore |
Ignores generated scripts/.version_env. |
.dockerignore |
Expands ignores (including .git) while keeping /bin available for packaging contexts. |
Comments suppressed due to low confidence (1)
scripts/version:26
- After verifying git availability with
git -C "${TOP_DIR}" ..., the script runs subsequentgit status,git rev-parse, andgit tagcommands without-C "${TOP_DIR}". Ifscripts/versionis sourced/executed from outside the repo directory, those commands will operate on the caller’s CWD and can fail or produce wrong values even though${TOP_DIR}is correct. Usinggit -C "${TOP_DIR}"consistently for all git commands would make the script location-independent.
if [ -n "$(git status --porcelain --untracked-files=no)" ]; then
DIRTY="-dirty"
fi
COMMIT=$(git rev-parse --short HEAD)
GIT_TAG=$(git tag -l --contains HEAD | head -n 1)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| DOCKER_BUILD = docker build \ | ||
| --progress=$(MK_DOCKER_PROGRESS) \ | ||
| --build-arg MK_REPO_ID \ | ||
| --build-arg MK_HOST_ARCH \ |
There was a problem hiding this comment.
good finding, fix in Export MK_HOST_ARCH
| if [[ -f "${_VERSION_ENV}" ]]; then | ||
| # shellcheck source=/dev/null | ||
| source "${_VERSION_ENV}" | ||
| return 0 2>/dev/null || true |
|
This pull request is now in conflict. Could you fix it @bk201? 🙏 |
- Replace the Dapper-driven Makefile (download + run .dapper binary) with a docker build --target workflow. - One Dockerfile at the repo root defines a stage per target (build, test, validate, validate-ci, generate, - generate-manifest) with BuildKit cache mounts for the Go module and build caches. - Host-side targets (package, package-webhook) continue to run docker buildx build directly. - Orchestration scripts (ci, default, entry, release) are deleted and replaced by Makefile targets that sequence the individual stages. - scripts/version gains a git-availability guard and writes scripts/.version_env so container builds and git worktree checkouts Signed-off-by: Kiefer Chang <kiefer.chang@suse.com>
The variable is used in CI workflows to push images to a temp registry. Signed-off-by: Kiefer Chang <kiefer.chang@suse.com>
Signed-off-by: Kiefer Chang <kiefer.chang@suse.com>
Signed-off-by: Kiefer Chang <kiefer.chang@suse.com>
Co-authored-by: Cooper Tseng <cooper.tseng@suse.com> Signed-off-by: Kiefer Chang <kiefer.chang@suse.com>
Co-authored-by: Cooper Tseng <cooper.tseng@suse.com> Signed-off-by: Kiefer Chang <kiefer.chang@suse.com>
| # syntax=docker/dockerfile:1 | ||
| # check=skip=InvalidDefaultArgInFrom | ||
|
|
||
| FROM registry.suse.com/bci/golang:1.26 AS builder |
Signed-off-by: Kiefer Chang <kiefer.chang@suse.com>
|
CI failed because upgrade_nm.sh run , which overrides the Could you please help add this patch: |
Thank you, the commit is included. |
Problem:
migrate from Dapper to single-Dockerfile build system
Solution:
docker build --target workflow.
validate, validate-ci, generate,
caches.
build directly.
by Makefile targets that sequence the individual stages.
so container builds and git worktree checkouts
Related Issue(s):
harvester/harvester#10604
Test plan:
Additional documentation or context