-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
65 lines (53 loc) · 2.89 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
#//////////////////////////////////////////////////////////////
#// ____ //
#// | __ ) ___ _ __ ___ _ _ _ __ ___ _ __ _ __ ___ //
#// | _ \ / _ \ '_ \/ __| | | | '_ \ / _ \ '__| '_ \ / __| //
#// | |_) | __/ | | \__ \ |_| | |_) | __/ | | |_) | (__ //
#// |____/ \___|_| |_|___/\__,_| .__/ \___|_| | .__/ \___| //
#// |_| |_| //
#//////////////////////////////////////////////////////////////
#// //
#// Script, 2021 //
#// Created: 30, May, 2021 //
#// Modified: 31, May, 2021 //
#// file: - //
#// - //
#// Source: https://github.com/axiom-data-science/rsync-server //
#// https://www.docker.com/blog/getting-started-with-docker-for-arm-on-linux/
#// https://schinckel.net/2021/02/12/docker-%2B-makefile/
#// https://www.padok.fr/en/blog/multi-architectures-docker-iot
#// OS: ALL //
#// CPU: ALL //
#// //
#//////////////////////////////////////////////////////////////
BASE_IMAGE := debian:buster-slim
IMAGE_NAME := bensuperpc/ndless
DOCKERFILE := Dockerfile
DOCKER := docker
TAG := $(shell date '+%Y%m%d')-$(shell git rev-parse --short HEAD)
DATE_FULL := $(shell date -u "+%Y-%m-%dT%H:%M:%SZ")
UUID := $(shell cat /proc/sys/kernel/random/uuid)
VERSION := 1.0.0
#Not in debian buster : riscv64
# Disable linux/386 linux/arm64 linux/ppc64le linux/s390x linux/arm/v7 linux/arm/v6
ARCH_LIST := linux/amd64
comma:= ,
COM_ARCH_LIST:= $(subst $() $(),$(comma),$(ARCH_LIST))
$(ARCH_LIST): $(DOCKERFILE)
$(DOCKER) buildx build . -f $(DOCKERFILE) -t $(IMAGE_NAME):$(TAG) -t $(IMAGE_NAME):latest \
--build-arg BUILD_DATE=$(DATE_FULL) --build-arg DOCKER_IMAGE=$(BASE_IMAGE) --platform $@ \
--build-arg VERSION=$(VERSION) --load
all: $(DOCKERFILE)
$(DOCKER) buildx build . -f $(DOCKERFILE) -t $(IMAGE_NAME):$(TAG) -t $(IMAGE_NAME):latest \
--build-arg BUILD_DATE=$(DATE_FULL) --build-arg DOCKER_IMAGE=$(BASE_IMAGE) --platform $(COM_ARCH_LIST) \
--build-arg VERSION=$(VERSION) --push
push: all
# https://github.com/linuxkit/linuxkit/tree/master/pkg/binfmt
qemu:
export DOCKER_CLI_EXPERIMENTAL=enabled
$(DOCKER) run --rm --privileged linuxkit/binfmt:v0.8
$(DOCKER) buildx create --name mybuilder --driver docker-container --use
$(DOCKER) buildx inspect --bootstrap
clean:
$(DOCKER) images --filter='reference=$(IMAGE_NAME)' --format='{{.Repository}}:{{.Tag}}' | xargs -r $(DOCKER) rmi -f
.PHONY: build push clean qemu $(ARCH_LIST)