Skip to content
This repository has been archived by the owner on Jun 13, 2021. It is now read-only.

Commit

Permalink
Also introduce armhf support for docker app plugin and cnab-app-base …
Browse files Browse the repository at this point in the history
…invocation image.

Signed-off-by: Silvin Lubecki <[email protected]>
  • Loading branch information
silvin-lubecki committed Dec 9, 2019
1 parent ce29c19 commit 743f7fc
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 4 deletions.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ RUN git clone https://github.com/docker/cli . && git checkout v${CLI_VERSION}
RUN mkdir build
RUN curl -fL https://download.docker.com/linux/static/${CLI_CHANNEL}/x86_64/docker-${CLI_VERSION}.tgz | tar xzO docker/docker > build/docker-linux-amd64 && chmod +x build/docker-linux-amd64
RUN curl -fL https://download.docker.com/linux/static/${CLI_CHANNEL}/aarch64/docker-${CLI_VERSION}.tgz | tar xzO docker/docker > build/docker-linux-arm64 && chmod +x build/docker-linux-arm64
RUN curl -fL https://download.docker.com/linux/static/${CLI_CHANNEL}/armhf/docker-${CLI_VERSION}.tgz | tar xzO docker/docker > build/docker-linux-arm && chmod +x build/docker-linux-arm
RUN curl -fL https://download.docker.com/mac/static/${CLI_CHANNEL}/x86_64/docker-${CLI_VERSION}.tgz | tar xzO docker/docker > build/docker-darwin-amd64

ARG GOPROXY
Expand Down Expand Up @@ -68,6 +69,7 @@ FROM scratch AS cross
ARG PROJECT_PATH=/go/src/github.com/docker/app
COPY --from=cross-build ${PROJECT_PATH}/bin/docker-app-linux docker-app-linux
COPY --from=cross-build ${PROJECT_PATH}/bin/docker-app-linux-arm64 docker-app-linux-arm64
COPY --from=cross-build ${PROJECT_PATH}/bin/docker-app-linux-arm docker-app-linux-arm
COPY --from=cross-build ${PROJECT_PATH}/bin/docker-app-darwin docker-app-darwin
COPY --from=cross-build ${PROJECT_PATH}/bin/docker-app-windows.exe docker-app-windows.exe

Expand Down
5 changes: 5 additions & 0 deletions Jenkinsfile.baguette
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ pipeline {
dir('_build') {
stash name: 'invocation-image', includes: 'invocation-image.tar'
stash name: 'invocation-image-arm64', includes: 'invocation-image-arm64.tar'
stash name: 'invocation-image-arm', includes: 'invocation-image-arm.tar'
stash name: 'coverage-invocation-image', includes: 'coverage-invocation-image.tar'
archiveArtifacts 'invocation-image*.tar'
}
Expand All @@ -80,6 +81,7 @@ pipeline {
always {
sh 'docker rmi docker/cnab-app-base:$TAG'
sh 'docker rmi docker/cnab-app-base:$TAG-arm64'
sh 'docker rmi docker/cnab-app-base:$TAG-arm'
sh 'docker rmi docker/cnab-app-base:$TAG-coverage'
deleteDir()
}
Expand Down Expand Up @@ -254,6 +256,8 @@ pipeline {
sh 'docker load -i invocation-image.tar'
unstash "invocation-image-arm64"
sh 'docker load -i invocation-image-arm64.tar'
unstash "invocation-image-arm"
sh 'docker load -i invocation-image-arm.tar'
}
ansiColor('xterm') {
sh 'make -f docker.Makefile push-invocation-image'
Expand All @@ -269,6 +273,7 @@ pipeline {
always {
sh 'docker rmi docker/cnab-app-base:$TAG'
sh 'docker rmi docker/cnab-app-base:$TAG-arm64'
sh 'docker rmi docker/cnab-app-base:$TAG-arm'
deleteDir()
}
}
Expand Down
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ check_go_env:

cross: cross-plugin ## cross-compile binaries (linux, darwin, windows)

cross-plugin: bin/$(BIN_NAME)-linux bin/$(BIN_NAME)-darwin bin/$(BIN_NAME)-windows.exe bin/$(BIN_NAME)-linux-arm64
cross-plugin: bin/$(BIN_NAME)-linux bin/$(BIN_NAME)-darwin bin/$(BIN_NAME)-windows.exe bin/$(BIN_NAME)-linux-arm64 bin/$(BIN_NAME)-linux-arm

e2e-cross: bin/$(BIN_NAME)-e2e-linux bin/$(BIN_NAME)-e2e-darwin bin/$(BIN_NAME)-e2e-windows.exe

Expand All @@ -53,6 +53,10 @@ bin/$(BIN_NAME)-e2e-%.exe bin/$(BIN_NAME)-e2e-%: e2e bin/$(BIN_NAME)-%
bin/$(BIN_NAME)-linux-arm64: cmd/$(BIN_NAME) check_go_env
GOOS=linux GOARCH=arm64 $(GO_BUILD) -o $@ ./$<

.PHONY: bin/$(BIN_NAME)-linux-arm
bin/$(BIN_NAME)-linux-arm: cmd/$(BIN_NAME) check_go_env
GOOS=linux GOARCH=arm $(GO_BUILD) -o $@ ./$<

.PHONY: bin/$(BIN_NAME)-windows
bin/$(BIN_NAME)-%.exe bin/$(BIN_NAME)-%: cmd/$(BIN_NAME) check_go_env
GOOS=$* $(GO_BUILD) -o $@ ./$<
Expand Down
15 changes: 12 additions & 3 deletions docker.Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ cross: create_bin ## cross-compile binaries (linux, darwin, windows)
docker build $(BUILD_ARGS) --output type=local,dest=./bin/ --target=cross -t $(CROSS_IMAGE_NAME) .
@$(call chmod,+x,bin/$(BIN_NAME)-linux)
@$(call chmod,+x,bin/$(BIN_NAME)-linux-arm64)
@$(call chmod,+x,bin/$(BIN_NAME)-linux-arm)
@$(call chmod,+x,bin/$(BIN_NAME)-darwin)
@$(call chmod,+x,bin/$(BIN_NAME)-windows.exe)

Expand All @@ -62,6 +63,7 @@ tars:
tar --transform='flags=r;s|$(BIN_NAME)-linux|$(BIN_NAME)-plugin-linux|' -czf bin/$(BIN_NAME)-linux.tar.gz -C bin $(BIN_NAME)-linux
tar czf bin/$(BIN_NAME)-e2e-linux.tar.gz -C bin $(BIN_NAME)-e2e-linux
tar --transform='flags=r;s|$(BIN_NAME)-linux-arm64|$(BIN_NAME)-plugin-linux-arm64|' -czf bin/$(BIN_NAME)-linux-arm64.tar.gz -C bin $(BIN_NAME)-linux-arm64
tar --transform='flags=r;s|$(BIN_NAME)-linux-arm|$(BIN_NAME)-plugin-linux-arm|' -czf bin/$(BIN_NAME)-linux-arm.tar.gz -C bin $(BIN_NAME)-linux-arm
tar --transform='flags=r;s|$(BIN_NAME)-darwin|$(BIN_NAME)-plugin-darwin|' -czf bin/$(BIN_NAME)-darwin.tar.gz -C bin $(BIN_NAME)-darwin
tar czf bin/$(BIN_NAME)-e2e-darwin.tar.gz -C bin $(BIN_NAME)-e2e-darwin
tar --transform='flags=r;s|$(BIN_NAME)-windows|$(BIN_NAME)-plugin-windows|' -czf bin/$(BIN_NAME)-windows.tar.gz -C bin $(BIN_NAME)-windows.exe
Expand Down Expand Up @@ -126,7 +128,10 @@ invocation-image:
invocation-image-arm64:
docker build -f Dockerfile.invocation-image $(BUILD_ARGS) --target=invocation -t $(CNAB_BASE_INVOCATION_IMAGE_NAME)-arm64 --platform=arm64 .

invocation-image-cross: invocation-image invocation-image-arm64
invocation-image-arm:
docker build -f Dockerfile.invocation-image $(BUILD_ARGS) --target=invocation -t $(CNAB_BASE_INVOCATION_IMAGE_NAME)-arm --platform=arm .

invocation-image-cross: invocation-image invocation-image-arm64 invocation-image-arm

save-invocation-image-tag:
docker tag $(CNAB_BASE_INVOCATION_IMAGE_NAME) docker/cnab-app-base:$(INVOCATION_IMAGE_TAG)
Expand All @@ -138,6 +143,7 @@ save-invocation-image:

save-invocation-image-cross: save-invocation-image
docker save $(CNAB_BASE_INVOCATION_IMAGE_NAME)-arm64 -o $(CNAB_BASE_INVOCATION_IMAGE_PATH)-arm64.tar
docker save $(CNAB_BASE_INVOCATION_IMAGE_NAME)-arm -o $(CNAB_BASE_INVOCATION_IMAGE_PATH)-arm.tar

push-invocation-image:
# tag and push linux/amd64
Expand All @@ -146,11 +152,14 @@ push-invocation-image:
# tag and push linux/arm64
docker tag $(CNAB_BASE_INVOCATION_IMAGE_NAME)-arm64 $(PUSH_CNAB_BASE_INVOCATION_IMAGE_NAME)-arm64
docker push $(PUSH_CNAB_BASE_INVOCATION_IMAGE_NAME)-arm64
# tag and push linux/armhf
docker tag $(CNAB_BASE_INVOCATION_IMAGE_NAME)-arm $(PUSH_CNAB_BASE_INVOCATION_IMAGE_NAME)-arm
docker push $(PUSH_CNAB_BASE_INVOCATION_IMAGE_NAME)-arm
# create and push manifest list
docker manifest create $(PUSH_CNAB_BASE_INVOCATION_IMAGE_NAME) $(PUSH_CNAB_BASE_INVOCATION_IMAGE_NAME) $(PUSH_CNAB_BASE_INVOCATION_IMAGE_NAME)-arm64
docker manifest create $(PUSH_CNAB_BASE_INVOCATION_IMAGE_NAME) $(PUSH_CNAB_BASE_INVOCATION_IMAGE_NAME) $(PUSH_CNAB_BASE_INVOCATION_IMAGE_NAME)-arm64 $(PUSH_CNAB_BASE_INVOCATION_IMAGE_NAME)-arm
docker manifest push $(PUSH_CNAB_BASE_INVOCATION_IMAGE_NAME)

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

.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
.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-arm invocation-image-arm64 invocation-image-cross save-invocation-image save-invocation-image-tag push-invocation-image

0 comments on commit 743f7fc

Please sign in to comment.