-
-
Notifications
You must be signed in to change notification settings - Fork 19
/
Makefile
71 lines (57 loc) · 1.81 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# Makefile
#
# @since 2016-09-23
# @category Docker
# @author Nicola Asuni <[email protected]>
# @copyright 2015-2024 Nicola Asuni - Tecnick.com LTD
# @license MIT (see LICENSE)
# @link https://github.com/tecnickcom/alldev
#
# This file is part of alldev project.
# ----------------------------------------------------------------------------------------------------------------------
# Project owner
OWNER=tecnickcom
# Project vendor
VENDOR=${OWNER}
# Project name
PROJECT=alldev
# Project version
VERSION=$(shell cat VERSION)
# Project release number (packaging build number)
RELEASE=$(shell cat RELEASE)
# Current directory
CURRENTDIR=$(shell pwd)
# Docker registry
DOCKER_REGISTRY=
# Docker repository
DOCKER_REPOSITORY=${DOCKER_REGISTRY}${VENDOR}
# --- MAKE TARGETS ---
# Display general help about this command
.PHONY: help
help:
@echo ""
@echo "${PROJECT} Makefile."
@echo "The following commands are available:"
@echo ""
@echo " make build DIMG=<IMAGE_DIR> : Build the specified Docker images"
@echo " make upload DIMG=<IMAGE_DIR> : Upload the specified Docker images (only with the right credentials)"
@echo " make tag : Tag the Git repository"
@echo ""
# Alias for help target
.PHONY: all
all: help
# Build the specified Docker image
.PHONY: build
build:
docker build --compress --no-cache --tag ${DOCKER_REPOSITORY}/${DIMG}:latest --file ./src/${DIMG}.Dockerfile ./src/
docker tag ${DOCKER_REPOSITORY}/${DIMG}:latest ${DOCKER_REPOSITORY}/${DIMG}:${VERSION}-${RELEASE}
# Upload the specified docker image
.PHONY: upload
upload:
docker push ${DOCKER_REPOSITORY}/${DIMG}:latest
docker push ${DOCKER_REPOSITORY}/${DIMG}:${VERSION}-${RELEASE}
# Tag the Git repository
.PHONY: tag
tag:
git tag -a "v$(VERSION)" -m "Version $(VERSION)" && \
git push origin --tags