-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
71 lines (57 loc) · 2.21 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
SHELL := /bin/bash
SOURCE := github.com/dcwangmit01/docker-electron-armhf
PACKAGE := registry.davidwang.com/paxarm/docker-electron-armhf
VERSION:= dev
CACHE_DIR=.cache
TMP_DIR=.tmp
ELECTRON_ARCH=armv7l
ELECTRON_VERSION=1.4.15
ELECTRON_PACKAGE=electron-v$(ELECTRON_VERSION)-linux-$(ELECTRON_ARCH).zip
ELECTRON_URL=https://github.com/electron/electron/releases/download/v$(ELECTRON_VERSION)/$(ELECTRON_PACKAGE)
FFMPEG_PACKAGE=ffmpeg-v$(ELECTRON_VERSION)-linux-$(ELECTRON_ARCH).zip
FFMPEG_URL=https://github.com/electron/electron/releases/download/v$(ELECTRON_VERSION)/$(FFMPEG_PACKAGE)
ELECTRON_DIR=$(basename $(ELECTRON_PACKAGE))
ELECTRON_TGZ=$(basename $(ELECTRON_PACKAGE)).tar.gz
$(CACHE_DIR)/$(ELECTRON_TGZ):
: # Download the electron pkg, and the non-proprietary ffmeg pkg
mkdir -p $(CACHE_DIR)
if [ ! -f $(CACHE_DIR)/$(ELECTRON_PACKAGE) ]; then \
curl -fsSL $(ELECTRON_URL) > $(CACHE_DIR)/$(ELECTRON_PACKAGE); \
fi
if [ ! -f $(CACHE_DIR)/$(FFMPEG_PACKAGE) ]; then \
curl -fsSL $(FFMPEG_URL) > $(CACHE_DIR)/$(FFMPEG_PACKAGE); \
fi
: # convert zip files into a single gzip file
: # that dockerbuild can copy directly into archive
rm -rf $(CACHE_DIR)/$(ELECTRON_DIR)
mkdir -p $(CACHE_DIR)/$(ELECTRON_DIR)
unzip -o -d $(CACHE_DIR)/$(ELECTRON_DIR) $(CACHE_DIR)/$(ELECTRON_PACKAGE)
unzip -o -d $(CACHE_DIR)/$(ELECTRON_DIR) $(CACHE_DIR)/$(FFMPEG_PACKAGE)
pushd $(CACHE_DIR)/$(ELECTRON_DIR) && tar czf ../$(ELECTRON_TGZ) .
rm -rf $(CACHE_DIR)/$(ELECTRON_DIR)
$(CACHE_DIR)/qemu-arm-static:
cp /usr/bin/qemu-arm-static $(CACHE_DIR)
$(CACHE_DIR)/00aptproxy:
if [ -f /etc/apt/apt.conf.d/00aptproxy ]; then \
cp /etc/apt/apt.conf.d/00aptproxy $(CACHE_DIR)/00aptproxy; \
else \
touch $(CACHE_DIR)/00aptproxy; \
fi
deps:
npm install
docker: $(CACHE_DIR)/$(ELECTRON_TGZ) \
$(CACHE_DIR)/qemu-arm-static \
$(CACHE_DIR)/00aptproxy # deps
docker build \
--build-arg ELECTRON_TGZ=$(CACHE_DIR)/$(ELECTRON_TGZ) \
--tag $(PACKAGE):$(VERSION) .
docker-push:
docker push $(PACKAGE):$(VERSION)
docker-run:
docker run --rm -it $(PACKAGE):$(VERSION) bash
: #docker run -it --rm -v /usr/bin/qemu-arm-static:/usr/bin/qemu-arm-static test bash
clean:
rm -rf $(CACHE_DIR)
rm -rf $(TMP_DIR)
mrclean: clean
rm -rf ./node_modules