improved docker commands
This commit is contained in:
parent
93eea1fad0
commit
f928efad52
@ -2,6 +2,9 @@ BINARY = {{cookiecutter.project_slug}}
|
||||
BUILD_DIR = build
|
||||
BUILD_ARCH = $(shell go env GOARCH)
|
||||
BUILD_OS = $(shell go env GOOS)
|
||||
DOCKER_BUILD_FLAGS =
|
||||
DOCKER_BUILD_PLATFORM = linux/amd64,linux/arm64,linux/arm32v6,linux/arm32v7
|
||||
DOCKER_BUILD_TAG = {{cookiecutter.docker_username}}/{{cookiecutter.project_slug}}
|
||||
|
||||
.PHONY: all
|
||||
all: clean build
|
||||
@ -16,6 +19,10 @@ $(BUILD_DIR)/$(BINARY):
|
||||
clean:
|
||||
rm -rf $(BUILD_DIR)
|
||||
|
||||
.PHONY: docker
|
||||
docker:
|
||||
docker buildx build --platform linux/arm64,linux/amd64,linux/arm/v7,linux/arm64/v8 -t djeeberjr/{{cookiecutter.project_slug}} . --push
|
||||
.PHONY: docker-push
|
||||
docker-push:
|
||||
docker buildx build $(DOCKER_BUILD_FLAGS) --platform $(DOCKER_BUILD_PLATFORM) -t $(DOCKER_BUILD_TAG) . --push
|
||||
|
||||
.PHONY: docker-local
|
||||
docker-local:
|
||||
docker buildx build $(DOCKER_BUILD_FLAGS) -t $(DOCKER_BUILD_TAG) . --load
|
||||
|
@ -6,5 +6,4 @@
|
||||
|
||||
## Build and push docker image
|
||||
|
||||
`make docker`
|
||||
|
||||
To build the image localy run `make docker-local` and to build and push `make docker-push`.
|
||||
|
Loading…
Reference in New Issue
Block a user