-
Notifications
You must be signed in to change notification settings - Fork 100
/
Makefile
70 lines (57 loc) · 1.72 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
IMAGE:=sameersbn/$(shell basename $$PWD)
RELEASE=$(shell cat VERSION)
all: build
XSOCK=/tmp/.X11-unix
XAUTH=/tmp/.docker.xauth
CAPABILITIES = \
--cap-add=SYS_ADMIN
ENV_VARS = \
--env="USER_UID=$(shell id -u)" \
--env="USER_GID=$(shell id -g)" \
--env="DISPLAY" \
--env="XAUTHORITY=${XAUTH}"
VOLUMES = \
--volume=${XSOCK}:${XSOCK} \
--volume=${XAUTH}:${XAUTH} \
--volume=/run/user/$(shell id -u)/pulse:/run/pulse
ENV_INSTL_USER = \
--env="BROWSER_BOX_USER=${USER}" \
--env="BROWSER_BOX_REPO=${USER}"
ifdef CHROME_USERDATA
ENV_CHROME_USERDATA = \
--env="CHROME_USERDATA=${CHROME_USERDATA}"
endif
ifdef FIREFOX_USERDATA
ENV_FIREFOX_USERDATA = \
--env="FIREFOX_USERDATA=${FIREFOX_USERDATA}"
endif
help:
@echo ""
@echo "-- Help Menu"
@echo ""
@echo " 1. make build - build the browser-box image"
@echo " 1. make install - install launch wrappers"
@echo " 2. make google-chrome - launch google-chrome"
@echo " 2. make tor-browser - launch tor-browser"
@echo " 2. make bash - bash login"
@echo ""
clean:
@docker rm -f `docker ps -a | grep "${IMAGE}" | awk '{print $$1}'` > /dev/null 2>&1 || exit 0
@docker rmi `docker images | grep "${IMAGE}" | awk '{print $$3}'` > /dev/null 2>&1 || exit 0
build:
@docker build --tag=${IMAGE}:${RELEASE} .
install uninstall: build
@docker run -it --rm \
--volume=/usr/local/bin:/target \
${ENV_CHROME_USERDATA} \
${ENV_FIREFOX_USERDATA} \
${ENV_INSTL_USER} \
${IMAGE}:${RELEASE} $@
google-chrome tor-browser chromium-browser firefox bash:
@touch ${XAUTH}
@xauth nlist :0 | sed -e 's/^..../ffff/' | xauth -f ${XAUTH} nmerge -
docker run -it --rm \
${CAPABILITIES} \
${ENV_VARS} \
${VOLUMES} \
${IMAGE}:${RELEASE} $@