Build multiarch docker images for release: amd, s390x, arm (#251)

This commit is contained in:
Namrata Bhave 2021-09-23 17:25:01 +05:30 committed by GitHub
parent 127194b205
commit 2e9ba5024e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 7 deletions

View File

@ -11,8 +11,6 @@ COPY cmd /tmp/fullstorydev/grpcurl/cmd
# and build a completely static binary (so we can use
# scratch as basis for the final image)
ENV CGO_ENABLED=0
ENV GOOS=linux
ENV GOARCH=amd64
ENV GO111MODULE=on
RUN go build -o /grpcurl \
-ldflags "-w -extldflags \"-static\" -X \"main.version=$(cat VERSION)\"" \

View File

@ -40,12 +40,17 @@ $PREFIX git checkout go.mod go.sum
# if there are no valid current credentials.
$PREFIX docker login
echo "$VERSION" > VERSION
$PREFIX docker build -t "fullstorydev/grpcurl:${VERSION}" .
rm VERSION
# Docker Buildx support is included in Docker 19.03
# Below step installs emulators for different architectures on the host
# This enables running and building containers for below architectures mentioned using --platforms
$PREFIX docker run --privileged --rm tonistiigi/binfmt:qemu-v6.1.0 --install all
# Create a new builder instance
export DOCKER_CLI_EXPERIMENTAL=enabled
$PREFIX docker buildx create --use --name multiarch-builder
# push to docker hub, both the given version as a tag and for "latest" tag
$PREFIX docker push "fullstorydev/grpcurl:${VERSION}"
$PREFIX docker tag "fullstorydev/grpcurl:${VERSION}" fullstorydev/grpcurl:latest
$PREFIX docker push fullstorydev/grpcurl:latest
$PREFIX docker buildx build --platform linux/amd64,linux/s390x,linux/arm64 --tag fullstorydev/grpcurl:${VERSION} --tag fullstorydev/grpcurl:latest --push --progress plain --no-cache .
rm VERSION
# Homebrew release