forked from groundnuty/io-lab-docker-ci-public
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
53 lines (40 loc) · 1.9 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
# Git repo metadata
TAG = $(shell git describe --tags --always)
# TODO: if your docher hub account name is different then this on github ovrwrite this this variable with docer hub accout name
PREFIX = lwronski
# TODO: if your repository name is different then this github repository name on ovrwrite this variable with docer hub repo name
REPO_NAME = lab-docker-ci-public
# Image metadata
# Name of the repository
SCHEMA_NAME = $(PREFIX)/$(REPO_NAME)
SCHEMA_DESCRIPTION = My image!
SCHEMA_URL = http://example.com
# Vendor set to github user name
SCEHMA_VENDOR = $(PREFIX)
SCHEMA_VSC_URL = https://github.com/$(PREFIX)/$(REPO_NAME)
# git commit shirt sha
SCHEMA_VCS_REF = $(shell git rev-parse --short HEAD)
SCHEMA_BUILD_DATE = $(shell date -u +'%Y-%m-%dT%H:%M:%SZ')
SCHEMA_BUILD_VERSION = your app version - framework specyfic
SCHEMA_CMD = the command your run this container with
all: push
image:
# TODO: this build command is incomplete, add last flag of this command that tags image as latest upon building it
docker build . -t "$(PREFIX)/$(REPO_NAME):latest" \
--build-arg SCHEMA_NAME="$(SCHEMA_NAME)" \
--build-arg SCHEMA_DESCRIPTION="$(SCHEMA_DESCRIPTION)" \
--build-arg SCHEMA_URL="$(SCHEMA_URL)" \
--build-arg SCEHMA_VENDOR="$(SCEHMA_VENDOR)" \
--build-arg SCHEMA_VSC_URL="$(SCHEMA_VSC_URL)" \
--build-arg SCHEMA_VCS_REF="$(SCHEMA_VCS_REF)" \
--build-arg SCHEMA_BUILD_DATE="$(SCHEMA_BUILD_DATE)" \
--build-arg SCHEMA_BUILD_VERSION="$(SCHEMA_BUILD_VERSION)" \
--build-arg SCHEMA_CMD="$(SCHEMA_CMD)" \
&& docker tag "$(PREFIX)/$(REPO_NAME):latest" "$(PREFIX)/$(REPO_NAME):$(TAG)"
# TODO: last part of this command that tags just built image with a specyfic tag
push: image
docker push "$(PREFIX)/$(REPO_NAME):latest"
docker push "$(PREFIX)/$(REPO_NAME):$(TAG)"
# TODO: two commands, first pushes the latest image, second pushes the image tagged with specyfic tag
clean:
.PHONY: clean image push all