Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Not needed to build the image. Anything untracked that reaches the builder makes
# the Go toolchain stamp the binary +dirty, so keep local files out of the context.
# .git must stay in the context: the Go toolchain reads it to stamp the module
# version and vcs info in the binary.
bin
cover.out
CLAUDE.md
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,3 @@ pkg/agent/sveltos-agent-in-mgmt-cluster.yaml-e
pkg/agent/sveltos-agent.yaml-e

version.txt

.dockerignore
11 changes: 10 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -452,8 +452,17 @@ docker-build: ## Build docker image with the manager.
docker-push: ## Push docker image with the manager.
docker push $(CONTROLLER_IMG):$(TAG)

.PHONY: check-clean-tree
check-clean-tree: ## Fail if the working tree is not clean: the Go build info of the image would say +dirty
@# CLAUDE.md is untracked on purpose and is excluded from the image by .dockerignore
@if [ -n "$$(git status --porcelain -- . ':(exclude)CLAUDE.md')" ]; then \
echo "The working tree is not clean, the image would be stamped +dirty. Commit, stash or remove:"; \
git status --porcelain -- . ':(exclude)CLAUDE.md'; \
exit 1; \
fi

.PHONY: docker-buildx
docker-buildx: ## docker build for multiple arch and push to docker hub
docker-buildx: check-clean-tree ## docker build for multiple arch and push to docker hub (fails if the working tree is not clean)
docker buildx build --push --platform linux/amd64,linux/arm64 --build-arg GIT_VERSION=$(TAG) --build-arg GIT_COMMIT=$(GIT_COMMIT) -t $(CONTROLLER_IMG):$(TAG) .

.PHONY: load-image
Expand Down