Makefile 1.14 KB
Newer Older
1
2
ifndef CI_REGISTRY
CI_REGISTRY := registry.icinga.com
3
4
endif

5
6
ifeq ($(CI_PROJECT_PATH),)
CI_PROJECT_PATH := build-docker/raspbian-base
7
endif
8
9
10
11
12
ifeq ($(CI_COMMIT_REF_NAME),)
CI_COMMIT_REF_NAME := $(shell git rev-parse --abbrev-ref HEAD)
endif

IMAGE := $(CI_PROJECT_PATH)/${CI_COMMIT_REF_NAME}
13

14
15
16
ifneq ($(CI_REGISTRY),)
IMAGE := $(CI_REGISTRY)/$(IMAGE)
endif
17

Alexander A. Klimov's avatar
Alexander A. Klimov committed
18
19
20
QEMU_VERSION = v5.2.0-11
QEMU_STATIC = https://github.com/multiarch/qemu-user-static/releases/download/$(QEMU_VERSION)/x86_64_qemu-arm-static.tar.gz
QEMU_CHECKSUM = 3233ece85d71729065950e52714020369c2f3aaa5616d7361fe1cc275673252598f196c4fc5f3cdf4747cd24a5e8f9eb076323501e9a8760a514f3f579bfcd3e
21

22
23
24
25
26
27
.PHONY: all tarball clean

all: build

tarball: rootfs.tar.xz
rootfs.tar.xz:
Markus Frosch's avatar
Markus Frosch committed
28
29
	TARBALL="$@.tmp" ./make-image.sh
	mv "$@.tmp" "$@"
30

31
32
qemu-arm-static:
	wget "$(QEMU_STATIC)" -O $@.tar.gz
Markus Frosch's avatar
Markus Frosch committed
33
	echo "$(QEMU_CHECKSUM)  $@.tar.gz" | sha512sum -c - || (sha512sum $@.tar.gz; false)
34
35
36
37
	tar xf $@.tar.gz
	rm -f $@.tar.gz

build: qemu-arm-static tarball
38
39
40
41
	docker build --tag "$(IMAGE)" .

push:
	docker push "$(IMAGE)"
Markus Frosch's avatar
Markus Frosch committed
42
43

clean:
44
45
	rm -f *.tar*
	if (docker inspect --type image "$(IMAGE)" >/dev/null 2>&1); then docker rmi "$(IMAGE)"; fi