Skip to content

Commit

Permalink
Merge pull request #57 from timuthy/feature.arm64-support
Browse files Browse the repository at this point in the history
Build Multi-Arch Images 📦
  • Loading branch information
unmarshall authored Jul 7, 2022
2 parents bc008d2 + 7276792 commit 606ac15
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 19 deletions.
22 changes: 5 additions & 17 deletions .ci/build
Original file line number Diff line number Diff line change
Expand Up @@ -55,21 +55,9 @@ VERSION_FILE="$(${READLINK_BIN} -f "${SOURCE_PATH}/VERSION")"
VERSION="$(cat "${VERSION_FILE}")"
GIT_SHA=$(git rev-parse --short HEAD || echo "GitNotFound")

# If no LOCAL_BUILD environment variable is set, we configure the `go build` command
# to build for linux OS, amd64 architectures and without CGO enablement.
if [[ -z "$LOCAL_BUILD" ]]; then
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build \
-a \
-mod vendor \
-v \
-o "${BINARY_PATH}/linux-amd64/dependency-watchdog" \
main.go
CGO_ENABLED=0 GO111MODULE=on go build \
-mod vendor \
-v \
-o "${BINARY_PATH}/dependency-watchdog" \
main.go

# If the LOCAL_BUILD environment variable is set, we simply run `go build`.
else
GO111MODULE=on go build \
-mod vendor \
-v \
-o "${BINARY_PATH}/dependency-watchdog" \
main.go
fi
4 changes: 4 additions & 0 deletions .ci/pipeline_definitions
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ dependency-watchdog:
'inject-commit-hash'
inject_effective_version: true
publish:
oci-builder: docker-buildx
platforms:
- linux/amd64
- linux/arm64
dockerimages:
dependency-watchdog:
registry: 'gcr-readwrite'
Expand Down
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ build-local:

.PHONY: docker-image
docker-image:
@if [[ ! -f $(BIN_DIR)/linux-amd64/dependency-watchdog ]]; then echo "No binary found. Please run 'make build'"; false; fi
@docker build -t $(IMAGE_REPOSITORY):$(IMAGE_TAG) -f $(BUILD_DIR)/Dockerfile --rm .

.PHONY: docker-push
Expand Down
9 changes: 8 additions & 1 deletion build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,17 @@
#
# SPDX-License-Identifier: Apache-2.0

From golang:1.18.3 as builder

WORKDIR /go/src/github.com/gardener/dependency-watchdog
COPY . .

RUN make build

FROM alpine:3.15.4

RUN apk add --update bash curl

COPY ./bin/linux-amd64/dependency-watchdog /usr/local/bin/dependency-watchdog
COPY --from=builder /go/src/github.com/gardener/dependency-watchdog/bin/dependency-watchdog /usr/local/bin/dependency-watchdog
WORKDIR /
ENTRYPOINT ["/usr/local/bin/dependency-watchdog"]

0 comments on commit 606ac15

Please sign in to comment.