Skip to content

Commit f80419a

Browse files
authored
Update Makefile (#79)
* Update Makefile
1 parent c4e3e7f commit f80419a

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM golang:1.17.5-bullseye
22

3-
ARG VERSION
3+
ARG TAG
44

55
ENV GOPATH /go
66

@@ -13,7 +13,7 @@ RUN apt-get update \
1313
&& rm -rf /var/lib/apt/lists/*
1414

1515
RUN cd ${GOPATH}/src/github.com/mosuka/phalanx \
16-
&& make VERSION=${VERSION} build
16+
&& make TAG=${TAG} build
1717

1818

1919
FROM debian:bullseye-slim

Makefile

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ CGO_ENABLED ?= 0
55
CGO_CFLAGS ?=
66
CGO_LDFLAGS ?=
77
BUILD_TAGS ?=
8-
VERSION ?=
8+
TAG ?=
99
BIN_EXT ?=
1010
DOCKER_REPOSITORY ?= mosuka
1111

@@ -22,10 +22,10 @@ ifeq ($(GOARCH),)
2222
GOARCH = $(shell go version | awk -F ' ' '{print $$NF}' | awk -F '/' '{print $$2}')
2323
endif
2424

25-
ifeq ($(VERSION),)
26-
VERSION = latest
25+
ifeq ($(TAG),)
26+
TAG = latest
2727
endif
28-
LDFLAGS = -ldflags "-s -w -X \"github.com/mosuka/phalanx/version.Version=$(VERSION)\""
28+
LDFLAGS = -ldflags "-s -w -X \"github.com/mosuka/phalanx/version.Version=$(TAG)\""
2929

3030
ifeq ($(GOOS),windows)
3131
BIN_EXT = .exe
@@ -47,7 +47,7 @@ show-env:
4747
@echo " CGO_CFLAGS = $(CGO_CFLAGS)"
4848
@echo " CGO_LDFLAGS = $(CGO_LDFLAGS)"
4949
@echo " BUILD_TAGS = $(BUILD_TAGS)"
50-
@echo " VERSION = $(VERSION)"
50+
@echo " TAG = $(TAG)"
5151
@echo " BIN_EXT = $(BIN_EXT)"
5252
@echo " LDFLAGS = $(LDFLAGS)"
5353
@echo " PACKAGES = $(PACKAGES)"
@@ -97,24 +97,24 @@ docs:
9797
.PHONY: tag
9898
tag: show-env
9999
@echo ">> tagging github"
100-
ifeq ($(VERSION),$(filter $(VERSION),latest master ""))
101-
@echo "please specify VERSION"
100+
ifeq ($(TAG),$(filter $(TAG),latest master ""))
101+
@echo "please specify TAG"
102102
else
103-
git tag -a $(VERSION) -m "Release $(VERSION)"
104-
git push origin $(VERSION)
103+
git tag -a $(TAG) -m "Release $(TAG)"
104+
git push origin $(TAG)
105105
endif
106106

107107
.PHONY: docker-build
108108
docker-build: show-env
109109
@echo ">> building docker container image"
110-
docker build -t $(DOCKER_REPOSITORY)/phalanx:latest --build-arg VERSION=$(VERSION) .
111-
docker tag $(DOCKER_REPOSITORY)/phalanx:latest $(DOCKER_REPOSITORY)/phalanx:$(VERSION)
110+
docker build -t $(DOCKER_REPOSITORY)/phalanx:latest --build-arg TAG=$(TAG) .
111+
docker tag $(DOCKER_REPOSITORY)/phalanx:latest $(DOCKER_REPOSITORY)/phalanx:$(TAG)
112112

113113
.PHONY: docker-push
114114
docker-push: show-env
115115
@echo ">> pushing docker container image"
116116
docker push $(DOCKER_REPOSITORY)/phalanx:latest
117-
docker push $(DOCKER_REPOSITORY)/phalanx:$(VERSION)
117+
docker push $(DOCKER_REPOSITORY)/phalanx:$(TAG)
118118

119119
.PHONY: docker-clean
120120
docker-clean:

0 commit comments

Comments
 (0)