Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build and push ppc64le image #68

Closed
wants to merge 1 commit into from
Closed
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
36 changes: 36 additions & 0 deletions build.make
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,42 @@ push-%: container-%
build: $(CMDS:%=build-%)
container: $(CMDS:%=container-%)
push: $(CMDS:%=push-%)
all-push: $(CMDS:%=all-push-%)

export DOCKER_CLI_EXPERIMENTAL=enabled

all-push-%:
for arch in amd64 ppc64le; do \
IMAGE_WITH_ARCH=$(IMAGE_NAME)-$$arch; \
CGO_ENABLED=0 GOOS=linux GOARCH=$$arch go build $(GOFLAGS_VENDOR) -a -ldflags '-X main.version=$(REV) -extldflags "-static"' -o ./bin/$* ./cmd/$*; \
docker build -t $$IMAGE_WITH_ARCH:latest -f $(shell if [ -e ./cmd/$*/Dockerfile ]; then echo ./cmd/$*/Dockerfile; else echo Dockerfile; fi) --label revision=$(REV) .; \
push_image () { \
docker tag $$IMAGE_WITH_ARCH:latest $$IMAGE_WITH_ARCH:$$tag; \
docker push $$IMAGE_WITH_ARCH:$$tag; \
if [ "$$arch" = "amd64" ]; then \
docker tag $$IMAGE_WITH_ARCH:latest $(IMAGE_NAME):$$tag; \
docker push $(IMAGE_NAME):$$tag; \
fi; \
}; \
for tag in $(IMAGE_TAGS); do \
if [ "$$tag" = "canary" ] || echo "$$tag" | grep -q -e '-canary$$'; then \
: "creating or overwriting canary image"; \
push_image; \
elif docker pull $$IMAGE_WITH_ARCH:$$tag 2>&1 | tee /dev/stderr | grep -q "manifest for $(IMAGE_NAME):$$tag not found"; then \
: "creating release image"; \
push_image; \
else \
: "release image $(IMAGE_NAME):$$tag already exists, skipping push"; \
fi; \
done; \
done; \
for tag in $(IMAGE_TAGS); do \
docker manifest create $(IMAGE_NAME):$$tag $(shell echo $(ALL_ARCH) | sed -e "s~[^ ]*~$(IMAGE_NAME)\-&:\$$tag~g"); \
for arch in amd64 ppc64le; do \
docker manifest annotate --arch $$arch $(IMAGE_NAME):$$tag $(IMAGE_NAME)-$$arch:$$tag; \
done; \
docker manifest push $(IMAGE_NAME):$$tag; \
done; \

clean:
-rm -rf bin
Expand Down