Skip to content

Commit

Permalink
build: fix docker multiarch build
Browse files Browse the repository at this point in the history
  • Loading branch information
AlmogBaku committed Feb 9, 2024
1 parent 919281d commit 6ede1e0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 1 addition & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
ARG TARGETOS=linux
ARG TARGETARCH=amd64
ARG LDFLAGS
ARG VERSION

Expand All @@ -17,7 +15,7 @@ COPY . /workspace

### Core
FROM build AS build
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -ldflags="${LDFLAGS}" -o /out/runner cmd/streaming/*.go
RUN CGO_ENABLED=0 go build -ldflags="${LDFLAGS}" -o /out/runner cmd/streaming/*.go

FROM gcr.io/distroless/static:nonroot as runner
ARG VERSION
Expand Down
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,11 @@ LDFLAGS += -X main.version=$(VERSION)
build: fmt lint ## Build core binary.
go build -ldflags="${LDFLAGS}" -a -o bin/runner cmd/streaming/*

DOCKER_BUILD_FLAGS ?= --load

.PHONY: docker-build
docker-build: ## Build docker image with the Runner.
DOCKER_BUILDKIT=1 docker build --build-arg LDFLAGS="${LDFLAGS}" --build-arg VERSION="${VERSION}" -t ${IMAGE_BASE}:${VERSION} -t ${IMAGE_BASE}:latest .
docker buildx build ${DOCKER_BUILD_FLAGS} --build-arg LDFLAGS="${LDFLAGS}" --build-arg VERSION="${VERSION}" -t ${IMAGE_BASE}:${VERSION} -t ${IMAGE_BASE}:latest .

.PHONY: kind-load
kind-load: ## Load the runner into kind.
Expand Down

0 comments on commit 6ede1e0

Please sign in to comment.