-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
78 lines (63 loc) · 2.08 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
72
73
74
75
76
77
78
include common.mk
STATIC_IMAGE=luthersystems/${PROJECT}
SCRIPTS=$(shell find scripts -type f)
AWSCLI_VERSION=2.7.0
TFEDIT_VERSION=0.0.3
TFMIGRATE_VERSION=0.3.3
TFENV_VER=v3.0.0
HELM_VERSION=v3.15.2
HELM_DIFF_VERSION=v3.9.9
STATIC_IMAGE_DUMMY=${call IMAGE_DUMMY,${STATIC_IMAGE}/${VERSION}}
FQ_STATIC_IMAGE=$(call FQ_DOCKER_IMAGE,${STATIC_IMAGE})
FQ_STATIC_IMAGE_DUMMY=$(call PUSH_DUMMY,${FQ_STATIC_IMAGE}/${BUILD_VERSION})
FQ_MANIFEST_DUMMY=$(call MANIFEST_DUMMY,${FQ_STATIC_IMAGE}/${BUILD_VERSION})
ANSIBLE_ROLES=$(shell find ansible-roles)
ANSIBLE_PLUGINS=$(shell find ansible-plugins)
GRAFANA_DASHBOARDS=$(shell find grafana-dashboards)
LOCALARCH=$(if $(findstring ${HWTYPE},"x86_64"),amd64,${HWTYPE})
.PHONY: default
default: static
@
.PHONY: static
static: ${STATIC_IMAGE_DUMMY}
@
.PHONY: push
push: ${FQ_STATIC_IMAGE_DUMMY}
@
.PHONY: clean
clean:
rm -rf build
build-%: LOADARG=$(if $(findstring $*,${LOCALARCH}),--load)
build-%: Dockerfile ${ANSIBLE_ROLES} ${ANSIBLE_PLUGINS} ${GRAFANA_DASHBOARDS} ${SCRIPTS} ssh_config requirements.txt
${DOCKER} buildx build \
--platform linux/$* \
--build-arg AWSCLI_VER=${AWSCLI_VERSION} \
--build-arg TFEDIT_VER=${TFEDIT_VERSION} \
--build-arg TFMIGRATE_VER=${TFMIGRATE_VERSION} \
--build-arg TFENV_VER=${TFENV_VER} \
--build-arg HELM_VERSION=${HELM_VERSION} \
--build-arg HELM_DIFF_VERSION=${HELM_DIFF_VERSION} \
${LOADARG} \
-t ${STATIC_IMAGE}:${VERSION} \
.
${STATIC_IMAGE_DUMMY}:
make build-${LOCALARCH}
${MKDIR_P} $(dir $@)
${TOUCH} $@
${FQ_STATIC_IMAGE_DUMMY}: ${STATIC_IMAGE_DUMMY}
${DOCKER} tag ${STATIC_IMAGE}:${VERSION} ${FQ_STATIC_IMAGE}:${BUILD_VERSION}
${DOCKER} push ${FQ_STATIC_IMAGE}:${BUILD_VERSION}
${MKDIR_P} $(dir $@)
${TOUCH} $@
.PHONY: push-manifests
push-manifests: ${FQ_MANIFEST_DUMMY}
@
${FQ_MANIFEST_DUMMY}:
${DOCKER} buildx imagetools create \
--tag ${FQ_STATIC_IMAGE}:latest \
${FQ_STATIC_IMAGE}:${VERSION}-arm64 \
${FQ_STATIC_IMAGE}:${VERSION}-amd64
${DOCKER} buildx imagetools create \
--tag ${FQ_STATIC_IMAGE}:${VERSION} \
${FQ_STATIC_IMAGE}:${VERSION}-arm64 \
${FQ_STATIC_IMAGE}:${VERSION}-amd64