-
-
Notifications
You must be signed in to change notification settings - Fork 82
/
Copy pathdocker.mk
41 lines (36 loc) · 1.2 KB
/
docker.mk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
DOCKERFILE ?= ./build/Dockerfile
IMG_NAME ?= x1unix/go-playground
GO_VERSION ?= $(MIN_GO_VERSION)
NODE_VERSION ?= 20
.PHONY: docker
docker: docker-image docker-push-image
@echo ":: [✓] Done"
.PHONY: docker-push-image
docker-push-image: docker-login
@if [ -z "$(TAG)" ]; then\
echo "required parameter TAG is undefined" && exit 1; \
fi;
@echo ":: Pushing $(IMG_NAME):$(TAG) (as latest)..."
docker push $(IMG_NAME):$(TAG)
docker push $(IMG_NAME):latest
.PHONY: docker-login
docker-login:
@if [ -z "$(DOCKER_USER)" ]; then\
echo "required parameter DOCKER_USER is undefined" && exit 1; \
fi;
@if [ -z "$(DOCKER_PASS)" ]; then\
echo "required parameter DOCKER_PASS is undefined" && exit 1; \
fi;
@docker login -u $(DOCKER_USER) -p $(DOCKER_PASS) && echo "- Docker login success";
.PHONY: docker-image
docker-image:
@if [ -z "$(TAG)" ]; then\
echo "required parameter TAG is undefined" && exit 1; \
fi;
@echo ":: Building '$(IMG_NAME):latest' $(TAG)..."
docker image build -t $(IMG_NAME):latest -t $(IMG_NAME):$(TAG) -f $(DOCKERFILE) \
--build-arg APP_VERSION=$(TAG) \
--build-arg GO_VERSION=$(GO_VERSION) \
--build-arg NODE_VERSION=$(NODE_VERSION) \
--build-arg WASM_API_VER=$(WASM_API_VER) \
.