File tree Expand file tree Collapse file tree 5 files changed +20
-6
lines changed
Expand file tree Collapse file tree 5 files changed +20
-6
lines changed Original file line number Diff line number Diff line change @@ -10,14 +10,18 @@ variable "EXPECTED_MIGRATION_TIMESTAMP" {
1010 default = " "
1111}
1212
13+ variable "BUILD_PLATFORM" {
14+ default = " linux/amd64"
15+ }
16+
1317group "default" {
1418 targets = [" api" , " db-migrator" ]
1519}
1620
1721target "api" {
1822 context = " ."
1923 dockerfile = " api/Dockerfile"
20- platforms = [" linux/amd64 " ]
24+ platforms = [BUILD_PLATFORM ]
2125 tags = [" ${ REGISTRY_PREFIX } /api" ]
2226 args = {
2327 COMMIT_SHA = COMMIT_SHA
@@ -28,6 +32,6 @@ target "api" {
2832target "db-migrator" {
2933 context = " ."
3034 dockerfile = " db/Dockerfile"
31- platforms = [" linux/amd64 " ]
35+ platforms = [BUILD_PLATFORM ]
3236 tags = [" ${ REGISTRY_PREFIX } /db-migrator" ]
3337}
Original file line number Diff line number Diff line change @@ -2,6 +2,9 @@ ENV := $(shell cat ../../.last_used_env || echo "not-set")
22-include ../../.env.${ENV}
33PREFIX := $(strip $(subst ",,$(PREFIX ) ) )
44
5+ BUILD_ARCH ?= $(shell go env GOARCH)
6+ BUILD_PLATFORM ?= linux/$(BUILD_ARCH )
7+
58CLICKHOUSE_HOST ?= clickhouse
69
710ifeq ($(PROVIDER ) ,aws)
@@ -33,7 +36,7 @@ migrate-local:
3336
3437.PHONY : build
3538build :
36- @docker build --platform linux/ $( or $( BUILD_ARCH ) , $( shell go env GOARCH) ) --tag " $( CLICKHOUSE_MIGRATOR_IMAGE) " .
39+ @docker build --platform $( BUILD_PLATFORM ) --tag " $( CLICKHOUSE_MIGRATOR_IMAGE) " .
3740
3841.PHONY : build-and-upload
3942build-and-upload :build
Original file line number Diff line number Diff line change @@ -2,6 +2,9 @@ ENV := $(shell cat ../../.last_used_env || echo "not-set")
22-include ../../.env.${ENV}
33PREFIX := $(strip $(subst ",,$(PREFIX ) ) )
44
5+ BUILD_ARCH ?= $(shell go env GOARCH)
6+ BUILD_PLATFORM ?= linux/$(BUILD_ARCH )
7+
58expectedMigration := $(shell ./../../scripts/get-latest-migration.sh)
69
710ifeq ($(PROVIDER ) ,aws)
2831build-and-upload :
2932 $(eval COMMIT_SHA := $(shell git rev-parse --short HEAD) )
3033 $(eval EXPECTED_MIGRATION_TIMESTAMP := $(expectedMigration ) )
31- @ docker build --platform linux/ $( or $( BUILD_ARCH ) , $( shell go env GOARCH) ) --tag $(IMAGE_REGISTRY ) --push --build-arg COMMIT_SHA=" $( COMMIT_SHA) " --build-arg EXPECTED_MIGRATION_TIMESTAMP=" $( EXPECTED_MIGRATION_TIMESTAMP) " -f ./Dockerfile ..
34+ @ docker build --platform $( BUILD_PLATFORM ) --tag $(IMAGE_REGISTRY ) --push --build-arg COMMIT_SHA=" $( COMMIT_SHA) " --build-arg EXPECTED_MIGRATION_TIMESTAMP=" $( EXPECTED_MIGRATION_TIMESTAMP) " -f ./Dockerfile ..
3235
3336.PHONY : run
3437run :
Original file line number Diff line number Diff line change @@ -2,6 +2,9 @@ ENV := $(shell cat ../../.last_used_env || echo "not-set")
22-include ../../.env.${ENV}
33PREFIX := $(strip $(subst ",,$(PREFIX ) ) )
44
5+ BUILD_ARCH ?= $(shell go env GOARCH)
6+ BUILD_PLATFORM ?= linux/$(BUILD_ARCH )
7+
58ifeq ($(PROVIDER ) ,aws)
69 IMAGE_REGISTRY := $(AWS_ACCOUNT_ID).dkr.ecr.$(AWS_REGION).amazonaws.com/$(PREFIX)core/docker-reverse-proxy
710else
@@ -21,7 +24,7 @@ build-debug:
2124.PHONY : build-and-upload
2225build-and-upload :
2326 $(eval COMMIT_SHA := $(shell git rev-parse --short HEAD) )
24- @docker buildx build --platform linux/ $( or $( BUILD_ARCH ) , $( shell go env GOARCH) ) --tag $(IMAGE_REGISTRY ) --push --build-arg COMMIT_SHA=" $( COMMIT_SHA) " -f ./Dockerfile ..
27+ @docker buildx build --platform $( BUILD_PLATFORM ) --tag $(IMAGE_REGISTRY ) --push --build-arg COMMIT_SHA=" $( COMMIT_SHA) " -f ./Dockerfile ..
2528
2629.PHONY : test
2730test :
Original file line number Diff line number Diff line change @@ -13,7 +13,8 @@ RUN go mod download
1313COPY . .
1414
1515# Build the plugin
16- RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /nomad-nodepool-apm .
16+ ARG TARGETARCH
17+ RUN CGO_ENABLED=0 GOOS=linux GOARCH=${TARGETARCH} go build -o /nomad-nodepool-apm .
1718
1819# Final stage - minimal image just to copy the binary from
1920FROM scratch
You can’t perform that action at this time.
0 commit comments