Makefile 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. .PHONY: build run
  2. # Default values for variables
  3. REPO ?= dorowu/ubuntu-desktop-lxde-vnc
  4. TAG ?= latest
  5. # you can choose other base image versions
  6. IMAGE ?= ubuntu:20.04
  7. # IMAGE ?= nvidia/cuda:10.1-cudnn7-devel-ubuntu18.04
  8. # choose from supported flavors (see available ones in ./flavors/*.yml)
  9. FLAVOR ?= lxde
  10. # armhf or amd64
  11. ARCH ?= amd64
  12. # These files will be generated from teh Jinja templates (.j2 sources)
  13. templates = Dockerfile rootfs/etc/supervisor/conf.d/supervisord.conf
  14. # Rebuild the container image
  15. build: $(templates)
  16. docker build -t $(REPO):$(TAG) .
  17. # Test run the container
  18. # the local dir will be mounted under /src read-only
  19. run:
  20. docker run --privileged --rm \
  21. -p 6080:80 -p 6081:443 \
  22. -v ${PWD}:/src:ro \
  23. -e USER=doro -e PASSWORD=mypassword \
  24. -e ALSADEV=hw:2,0 \
  25. -e SSL_PORT=443 \
  26. -e RELATIVE_URL_ROOT=approot \
  27. -e OPENBOX_ARGS="--startup /usr/bin/galculator" \
  28. -v ${PWD}/ssl:/etc/nginx/ssl \
  29. --device /dev/snd \
  30. --name ubuntu-desktop-lxde-test \
  31. $(REPO):$(TAG)
  32. # Connect inside the running container for debugging
  33. shell:
  34. docker exec -it ubuntu-desktop-lxde-test bash
  35. # Generate the SSL/TLS config for HTTPS
  36. gen-ssl:
  37. mkdir -p ssl
  38. openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
  39. -keyout ssl/nginx.key -out ssl/nginx.crt
  40. clean:
  41. rm -f $(templates)
  42. extra-clean:
  43. docker rmi $(REPO):$(TAG)
  44. docker image prune -f
  45. # Run jinja2cli to parse Jinja template applying rules defined in the flavors definitions
  46. %: %.j2 flavors/$(FLAVOR).yml
  47. docker run -v $(shell pwd):/data vikingco/jinja2cli \
  48. -D flavor=$(FLAVOR) \
  49. -D image=$(IMAGE) \
  50. -D localbuild=$(LOCALBUILD) \
  51. -D arch=$(ARCH) \
  52. $< flavors/$(FLAVOR).yml > $@ || rm $@