-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
35 lines (28 loc) · 856 Bytes
/
Makefile
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
NAME ?= $(shell basename $(shell pwd))
ORG ?=
REPO := ${ORG}/${NAME}
ifeq (${ORG},)
REPO := ${NAME}
endif
# Use latest tag if VERSION is null
ifeq (${HASH},)
HASH := $(shell git rev-parse --short HEAD 2>/dev/null)
endif
ifeq (${VERSION},)
VERSION := ${HASH}
endif
TAG_BUILD := ${REPO}:${HASH}
TAG_RELEASE := ${REPO}:${VERSION}
all: build
generate_version:
@echo "VERSION=${VERSION}" > VERSION
@echo "HASH=${HASH}" >> VERSION
@echo "BUILD_DATE=$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')" >> VERSION
build/codespace: generate_version
docker build -t ${TAG_BUILD} --build-arg=REVISION=$(VERSION) -f Dockerfile.codespace .
docker tag ${TAG_BUILD} ${TAG_RELEASE}
build/gitpod: generate_version
docker build -t ${TAG_BUILD} --build-arg=REVISION=$(VERSION) -f Dockerfile.gitpod .
docker tag ${TAG_BUILD} ${TAG_RELEASE}
push:
docker push ${TAG_RELEASE}