-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
34 lines (27 loc) · 922 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
# stop on error, no built in rules, run silently
MAKEFLAGS="-S -s -r"
# get tag and commit information
IMAGE_COMMIT := $(shell git log -1 | head -n 1 | cut -d" " -f2)
IMAGE_TAG := $(shell git tag --contains ${IMAGE_COMMIT})
# set the version from the tag and commit details
IMAGE_VERSION := $(or $(IMAGE_TAG),$(IMAGE_COMMIT))
ifneq ($(shell git status --porcelain),)
IMAGE_VERSION := $(IMAGE_VERSION)-dirty
endif
# get image id based on tag or commit
IMAGE_VERSION := $(or $(IMAGE_TAG),$(IMAGE_COMMIT))
IMAGE_NAME := "ghcr.io/uwcip/shibboleth"
IMAGE_ID := "${IMAGE_NAME}:${IMAGE_VERSION}"
all: build
.PHONY: build
build:
@echo "building image for ${IMAGE_ID}"
docker build -t $(IMAGE_NAME):latest -t $(IMAGE_ID) .
.PHONY: push
push: build
@echo "pushing ${IMAGE_ID}"
docker push $(IMAGE_ID)
.PHONY: clean
clean:
@echo "removing built image ${IMAGE_ID}"
docker image rm -f $(IMAGE_NAME):latest $(IMAGE_ID)