Skip to content

Commit

Permalink
improve docker build performance
Browse files Browse the repository at this point in the history
  • Loading branch information
nilsgstrabo committed Aug 1, 2024
1 parent 98ad73e commit 4c45801
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
7 changes: 5 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
FROM docker.io/golang:1.22-alpine3.20 AS builder
FROM --platform=$BUILDPLATFORM docker.io/golang:1.22-alpine3.20 AS builder

ARG TARGETARCH

ENV CGO_ENABLED=0 \
GOOS=linux
GOOS=linux \
GOARCH=$TARGETARCH

WORKDIR /src

Expand Down
9 changes: 8 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,20 @@ VERSION=latest
BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
IMAGE_NAME=$(DOCKER_REGISTRY)/radix-cost-allocation:$(BRANCH)-$(VERSION)

.PHONY: build
build:
docker build -t $(IMAGE_NAME) .

push:
.PHONY: push
push: build
az acr login -n $(DOCKER_REGISTRY)
docker push $(IMAGE_NAME)

.PHONY: pushmultiplatform
pushmultiplatform:
az acr login -n $(DOCKER_REGISTRY)
docker buildx build --platform=linux/amd64,linux/arm64 -t $(IMAGE_NAME) --push .

.PHONY: test
test:
go test -cover `go list ./...`
Expand Down

0 comments on commit 4c45801

Please sign in to comment.