-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
59 lines (46 loc) · 1.69 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
# Copyright 2020 Keyport Techonologies, Inc. All rights reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Usage:
#
# make lint Lint the Dockerfile.
# make build Build the build image.
# make deploy Deploy, push the build image to an image registry.
# make clean Remove the build image from the local machine.
#
REGISTRY=keyporttech
BUILD_IMAGE=smi-build
SHELL := /bin/bash
TAG := $(shell cat version.txt)
build-build-image:
@echo "Building the docker build image ${REGISTRY}/${BUILD_IMAGE}:$(TAG) ..."
docker build -t ${REGISTRY}/${BUILD_IMAGE}:$(TAG) .
.PHONY: build-build-image
publish-build-image:
@echo "Publishing the build image ${REGISTRY}/${BUILD_IMAGE}:$(TAG) ..."
docker logout
docker login -u $${DOCKER_USER} -p $${DOCKER_PASSWORD}
docker push ${REGISTRY}/${BUILD_IMAGE}:$(TAG)
docker logout
.PHONY: publish-build-image
clean-build-image:
@echo "Removing the build image ${REGISTRY}/${BUILD_IMAGE}:$(TAG) ..."
docker rmi ${REGISTRY}/${BUILD_IMAGE}:$(TAG)
.PHONY: clean-build-image
lint:
@echo "Linting Dockerfile ..."
hadolint Dockerfile
.PHONY: lint
build: lint build-build-image
.PHONY: build
deploy: build publish-build-image
.PHONY: deploy
clean: clean-build-image
.PHONY: clean