-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
37 lines (31 loc) · 1.21 KB
/
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
36
37
ORGANIZATION := segence
REPOSITORY := $(shell basename -s .git `git config --get remote.origin.url`)
VERSION := $(shell git describe --tags --match 'v*' --abbrev=0 | cut -c2-)
FONT_ESC := $(shell printf '\033')
FONT_BOLD := ${FONT_ESC}[1m
FONT_NC := ${FONT_ESC}[0m # No colour
all:
@echo "Use a specific goal. To list all goals, type 'make help'"
.PHONY: build # Builds Docker image
build:
ifndef profile
$(error profile parameter is undefined)
endif
@docker buildx build --platform linux/amd64,linux/arm64 --load --tag $(ORGANIZATION)/$(REPOSITORY):$(VERSION)-$(profile) ./$(profile)
.PHONY: push # Pushes Docker image
ifndef profile
$(error profile parameter is undefined)
endif
push:
@docker push $(ORGANIZATION)/$(REPOSITORY):$(VERSION)-$(profile)
.PHONY: release # Releases new tag; arguments: 'version=[semver version number]': define the version to release
release:
ifndef version
$(error version parameter is undefined)
endif
@git tag $(version)
@git push --tags
.PHONY: help # Generate list of goals with descriptions
help:
@echo "Available goals:\n"
@grep '^.PHONY: .* #' Makefile | sed "s/\.PHONY: \(.*\) # \(.*\)/${FONT_BOLD}\1:${FONT_NC}\2~~/" | sed $$'s/~~/\\\n/g' | sed $$'s/~/\\\n\\\t/g'