-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
43 lines (34 loc) · 918 Bytes
/
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
DOCKER_IMAGE=zondax/builder-zemu
INTERACTIVE:=$(shell [ -t 0 ] && echo 1)
ifdef INTERACTIVE
INTERACTIVE_SETTING:="-i"
TTY_SETTING:="-t"
else
INTERACTIVE_SETTING:=
TTY_SETTING:=
endif
ifdef HASH
HASH_TAG:=$(HASH)
else
HASH_TAG:=latest
endif
build:
cd src && docker buildx build --platform=linux/amd64,linux/arm64 -t $(DOCKER_IMAGE):$(HASH_TAG) -t $(DOCKER_IMAGE):latest .
publish:
docker login
cd src && docker buildx build --platform=linux/amd64,linux/arm64 -t $(DOCKER_IMAGE):$(HASH_TAG) -t $(DOCKER_IMAGE):latest --push .
push: publish
pull:
docker pull $(DOCKER_IMAGE):$(HASH_TAG)
define run_docker
docker run $(TTY_SETTING) $(INTERACTIVE_SETTING) \
--privileged \
-u $(shell id -u):$(shell id -g) \
-v $(shell pwd):/project \
-e DISPLAY=$(shell echo ${DISPLAY}) \
-v /tmp/.X11-unix:/tmp/.X11-unix:ro \
$(1) \
"$(2)"
endef
shell: build
$(call run_docker,$(DOCKER_IMAGE):$(HASH_TAG),/bin/bash)