Skip to content

Commit

Permalink
[update] use buildx
Browse files Browse the repository at this point in the history
  • Loading branch information
bmf-san committed Apr 20, 2023
1 parent 417db69 commit da7d0df
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion app/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 ./

Expand Down

0 comments on commit da7d0df

Please sign in to comment.