From 3028e67989e9df6e656be87c0e51be61be752d31 Mon Sep 17 00:00:00 2001 From: "Salvador E. Tropea" Date: Sun, 14 Jun 2020 09:33:25 -0300 Subject: [PATCH] Added example of docker invocation to the Makefile As suggested by @leoheck in 2233c0e08a6206c4a5b6074862288b6852d51744 --- Makefile | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index dc80cae..7029e2b 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,10 @@ tagname = 10.4-5.1.6 docker_user = setsoft docker_img = setsoft/kicad_auto +CWD := $(abspath $(patsubst %/,%,$(dir $(abspath $(lastword $(MAKEFILE_LIST)))))) +USER_ID=$(shell id -u) +GROUP_ID=$(shell id -g) + download_packages: ./download.sh @@ -17,7 +21,7 @@ upload_image: release: build upload_image -# If docker is not installer int the host system +# If docker is not installed in the host system install_docker: sudo apt install docker.io sudo systemctl enable --now docker @@ -26,5 +30,18 @@ install_docker: clean: @ rm -rf *.deb +# Docker shell for the current user. +# You can access the desktop and your home. +# Changes to the docker image are discarded, but changes to your home are real changes. +docker_shell: + docker run -it --rm -v $(CWD):$(CWD) --workdir="$(CWD)" \ + -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$(DISPLAY) \ + --user $(USER_ID):$(GROUP_ID) \ + --volume="/etc/group:/etc/group:ro" \ + --volume="/etc/passwd:/etc/passwd:ro" \ + --volume="/etc/shadow:/etc/shadow:ro" \ + --volume="/home/$(USER):/home/$(USER):rw" \ + $(docker_img):$(tagname) /bin/bash + .PHONY: download_packages build_release upload_image install_docker clean