Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit 8ec5d25

Browse files
Push cnab-app-base image as a multi-arch image with linux-amd64 and linux-arm64 platforms.
Signed-off-by: Silvin Lubecki <[email protected]>
1 parent 8d02116 commit 8ec5d25

File tree

3 files changed

+28
-8
lines changed

3 files changed

+28
-8
lines changed

Jenkinsfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
dir('src/github.com/docker/app') {
7676
checkout scm
7777
ansiColor('xterm') {
78-
sh 'make -f docker.Makefile save-invocation-image'
78+
sh 'make -f docker.Makefile invocation-image save-invocation-image'
7979
sh 'make -f docker.Makefile INVOCATION_IMAGE_TAG=$TAG-coverage OUTPUT=coverage-invocation-image.tar save-invocation-image-tag'
8080
}
8181
dir('_build') {

Jenkinsfile.baguette

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,19 +65,21 @@ pipeline {
6565
dir('src/github.com/docker/app') {
6666
checkout scm
6767
ansiColor('xterm') {
68-
sh 'make -f docker.Makefile save-invocation-image'
68+
sh 'make -f docker.Makefile invocation-image-cross save-invocation-image-cross'
6969
sh 'make -f docker.Makefile save-invocation-image-tag INVOCATION_IMAGE_TAG=$TAG-coverage OUTPUT=coverage-invocation-image.tar'
7070
}
7171
dir('_build') {
7272
stash name: 'invocation-image', includes: 'invocation-image.tar'
73+
stash name: 'invocation-image-arm64', includes: 'invocation-image-arm64.tar'
7374
stash name: 'coverage-invocation-image', includes: 'coverage-invocation-image.tar'
74-
archiveArtifacts 'invocation-image.tar'
75+
archiveArtifacts 'invocation-image*.tar'
7576
}
7677
}
7778
}
7879
post {
7980
always {
8081
sh 'docker rmi docker/cnab-app-base:$TAG'
82+
sh 'docker rmi docker/cnab-app-base:$TAG-arm64'
8183
sh 'docker rmi docker/cnab-app-base:$TAG-coverage'
8284
deleteDir()
8385
}
@@ -250,6 +252,8 @@ pipeline {
250252
dir('_build') {
251253
unstash "invocation-image"
252254
sh 'docker load -i invocation-image.tar'
255+
unstash "invocation-image-arm64"
256+
sh 'docker load -i invocation-image-arm64.tar'
253257
}
254258
ansiColor('xterm') {
255259
sh 'make -f docker.Makefile push-invocation-image'
@@ -264,6 +268,7 @@ pipeline {
264268
post {
265269
always {
266270
sh 'docker rmi docker/cnab-app-base:$TAG'
271+
sh 'docker rmi docker/cnab-app-base:$TAG-arm64'
267272
deleteDir()
268273
}
269274
}

docker.Makefile

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ PKG_PATH := /go/src/$(PKG_NAME)
2020

2121

2222
CNAB_BASE_INVOCATION_IMAGE_NAME := docker/cnab-app-base:$(BUILD_TAG)
23-
CNAB_BASE_INVOCATION_IMAGE_PATH := _build/invocation-image.tar
23+
CNAB_BASE_INVOCATION_IMAGE_PATH := _build/invocation-image
2424

2525
PUSH_CNAB_BASE_INVOCATION_IMAGE_NAME := docker/cnab-app-base:$(TAG)
2626

@@ -121,21 +121,36 @@ specification/bindata.go: specification/schemas/*.json build_dev_image
121121
schemas: specification/bindata.go ## generate specification/bindata.go from json schemas
122122

123123
invocation-image:
124-
docker build -f Dockerfile.invocation-image $(BUILD_ARGS) --target=invocation -t $(CNAB_BASE_INVOCATION_IMAGE_NAME) .
124+
docker build -f Dockerfile.invocation-image $(BUILD_ARGS) --target=invocation -t $(CNAB_BASE_INVOCATION_IMAGE_NAME) -t $(CNAB_BASE_INVOCATION_IMAGE_NAME)-amd64 --platform=amd64 .
125+
126+
invocation-image-arm64:
127+
docker build -f Dockerfile.invocation-image $(BUILD_ARGS) --target=invocation -t $(CNAB_BASE_INVOCATION_IMAGE_NAME)-arm64 --platform=arm64 .
128+
129+
invocation-image-cross: invocation-image invocation-image-arm64
125130

126131
save-invocation-image-tag:
127132
docker tag $(CNAB_BASE_INVOCATION_IMAGE_NAME) docker/cnab-app-base:$(INVOCATION_IMAGE_TAG)
128133
docker save docker/cnab-app-base:$(INVOCATION_IMAGE_TAG) -o _build/$(OUTPUT)
129134

130-
save-invocation-image: invocation-image
135+
save-invocation-image:
131136
@$(call mkdir,_build)
132-
docker save $(CNAB_BASE_INVOCATION_IMAGE_NAME) -o $(CNAB_BASE_INVOCATION_IMAGE_PATH)
137+
docker save $(CNAB_BASE_INVOCATION_IMAGE_NAME) -o $(CNAB_BASE_INVOCATION_IMAGE_PATH).tar
138+
139+
save-invocation-image-cross: save-invocation-image
140+
docker save $(CNAB_BASE_INVOCATION_IMAGE_NAME)-arm64 -o $(CNAB_BASE_INVOCATION_IMAGE_PATH)-arm64.tar
133141

134142
push-invocation-image:
143+
# tag and push linux/amd64
135144
docker tag $(CNAB_BASE_INVOCATION_IMAGE_NAME) $(PUSH_CNAB_BASE_INVOCATION_IMAGE_NAME)
136145
docker push $(PUSH_CNAB_BASE_INVOCATION_IMAGE_NAME)
146+
# tag and push linux/arm64
147+
docker tag $(CNAB_BASE_INVOCATION_IMAGE_NAME)-arm64 $(PUSH_CNAB_BASE_INVOCATION_IMAGE_NAME)-arm64
148+
docker push $(PUSH_CNAB_BASE_INVOCATION_IMAGE_NAME)-arm64
149+
# create and push manifest list
150+
docker manifest create $(PUSH_CNAB_BASE_INVOCATION_IMAGE_NAME) $(PUSH_CNAB_BASE_INVOCATION_IMAGE_NAME) $(PUSH_CNAB_BASE_INVOCATION_IMAGE_NAME)-arm64
151+
docker manifest push $(PUSH_CNAB_BASE_INVOCATION_IMAGE_NAME)
137152

138153
help: ## this help
139154
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) | sort
140155

141-
.PHONY: lint test-e2e test-unit test cli-cross cross e2e-cross coverage coverage-run coverage-results shell build_dev_image tars vendor check-vendor schemas help invocation-image save-invocation-image save-invocation-image-tag push-invocation-image
156+
.PHONY: lint test-e2e test-unit test cli-cross cross e2e-cross coverage coverage-run coverage-results shell build_dev_image tars vendor check-vendor schemas help invocation-image invocation-image-arm64 invocation-image-cross save-invocation-image save-invocation-image-tag push-invocation-image

0 commit comments

Comments
 (0)