-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
66 lines (55 loc) · 1.71 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
.PHONY: build run prep
# Default values for variables
REPO ?= taccaci/ubuntu-desktop-lxde-vnc
TAG ?= latest
# you can choose other base image versions
IMAGE ?= ubuntu:bionic
# choose from supported flavors (see available ones in ./flavors/*.yml)
FLAVOR ?= lxde
# armhf or amd64
ARCH ?= amd64
# These files will be generated from the Jinja templates (.j2 sources)
templates = Dockerfile rootfs/etc/supervisor/conf.d/supervisord.conf
INCLUDES ?= ../includes
# Rebuild the container image
build: $(templates)
docker build -t $(REPO):$(TAG) .
# Test run the container
# the local dir will be mounted under /src read-only
run:
docker run --rm \
-p 6080:80 -p 6081:443 \
-v ${PWD}:/src:ro \
-e USER=doro -e PASSWORD=mypassword \
-e ALSADEV=hw:2,0 \
-e SSL_PORT=443 \
-e RELATIVE_URL_ROOT=approot \
-v ${PWD}/ssl:/etc/nginx/ssl \
--device /dev/snd \
--name ubuntu-desktop-lxde-test \
$(REPO):$(TAG)
# Connect inside the running container for debugging
shell:
docker exec -it ubuntu-desktop-lxde-test bash
# Generate the SSL/TLS config for HTTPS
gen-ssl:
mkdir -p ssl
openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
-keyout ssl/nginx.key -out ssl/nginx.crt
clean:
rm -f $(templates)
extra-clean:
docker rmi $(REPO):$(TAG)
docker image prune -f
prep:
# git submodule update
if [ -d "$(INCLUDES)" ]; then cp -r $(INCLUDES)/* .; fi
if [ -f "app.yml" ]; then cat app.yml >> flavors/$(FLAVOR).yml; fi
# Run jinja2cli to parse Jinja template applying rules defined in the flavors definitions
%: %.j2 flavors/$(FLAVOR).yml
docker run -v $(shell pwd):/data vikingco/jinja2cli \
-D flavor=$(FLAVOR) \
-D image=$(IMAGE) \
-D localbuild=$(LOCALBUILD) \
-D arch=$(ARCH) \
$< flavors/$(FLAVOR).yml > $@ || rm $@