diff --git a/Makefile b/Makefile index e004a6b..21a88e6 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ help: .DEFAULT_GOAL := help -.PHONY: docker-compose-build +.PHONY: docker-compose-build docker-compose-build: ## Build containers by docker-compose. ifeq ($(env), ci) docker-compose -f docker-compose.ci.yml build @@ -37,10 +37,14 @@ else docker-compose -f docker-compose-local.yml pull endif +.PHONY: setup-buildx +setup-buildx: ## Set up buildx builder. + docker buildx create --name buildx-builder + docker buildx use buildx-builder + .PHONY: build-and-push build-and-push: ## Build and push image to dockerhub. - docker build -f app/Dockerfile -t bmfsan/gobel-client-example ./app/ - docker push bmfsan/gobel-client-example + docker buildx build --no-cache --push --platform linux/amd64,linux/arm64 --file app/Dockerfile --tag bmfsan/gobel-client-example app/ .PHONY: lint lint: ## Run golint. diff --git a/app/Dockerfile b/app/Dockerfile index c85227d..3272edf 100644 --- a/app/Dockerfile +++ b/app/Dockerfile @@ -14,7 +14,7 @@ ENV GOARCH=amd64 RUN go build -o app -FROM --platform=linux/amd64 alpine +FROM --platform=$BUILDPLATFORM alpine COPY --from=builder /go/gobel-client-example/app ./