diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..afa4bcc --- /dev/null +++ b/Makefile @@ -0,0 +1,79 @@ +all: build +install: push + +.PHONY: rebuild builder update bash connect start stop restart bash logs debug cancel bootstrap reinit check + + + +# This is bootstrap image +bootstrap: bootstrap/Dockerfile + docker build --tag chsa/gbootstrap:latest bootstrap + +reinit: bootstrap/Dockerfile + docker build --no-cache --tag chsa/gbootstrap:latest bootstrap + +check: bootstrap/Dockerfile + if [ `docker ps -a | grep chsa/gbootstrap | wc -l` -gt 0 ]; then \ + docker rm gbootstrap ;\ + fi ;\ + docker run -v /home/docker/volumes/binpkgs:/var/cache/binpkgs --name gbootstrap -it chsa/gbootstrap:latest /bin/bash + + +# This is builder itself +builder: bootstrap bootstrap/Dockerfile + docker build --tag chsa/gbuilder:latest builder + +update: builder/Dockerfile + docker build --no-cache --tag chsa/gbuilder:latest builder + +bash: + if [ `docker ps | grep chsa/gbuilder:latest | wc -l` -eq 0 ]; then \ + if [ `docker ps -a | grep gbuilder:latest | wc -l` -gt 0 ]; then \ + echo "Stalled copy... Remove to continue..." ;\ + echo "docker rm gbuilder" ;\ + exit 1 ;\ + fi ;\ + docker run -v /home/docker/volumes/binpkgs:/var/cache/binpkgs --name gbuilder -it chsa/gbuilder:latest /bin/bash ;\ + else \ + echo "Already running..." ;\ + fi + +build: + if [ `docker ps | grep chsa/gbuilder:latest | wc -l` -eq 0 ]; then \ + if [ `docker ps -a | grep gbuilder:latest | wc -l` -gt 0 ]; then \ + echo "Stalled copy... Remove to continue..." ;\ + echo "docker rm gbuilder" ;\ + exit 1 ;\ + fi ;\ + docker run -v /home/docker/volumes/binpkgs:/var/cache/binpkgs --name gbuilder -t -d chsa/gbuilder:latest ;\ + else \ + echo "Already running..." ;\ + fi + +stop: + @if [ `docker ps | grep gbuilder | wc -l` -gt 0 ]; then \ + docker stop gbuilder ;\ + fi + +cancel: + @if [ `docker ps -a | grep gbuilder | wc -l` -gt 0 ]; then \ + docker stop gbuilder ;\ + docker rm -f gbuilder ;\ + fi + +restart: + make cancel + make build + +# Control +logs: + docker logs -f gbuilder + +connect: + docker exec -it gbuilder /bin/bash + +# Slow & big, avoid if possible +debug: stop + echo "Generating image from container. Thats slow!" ; \ + docker commit gbuilder gbuilder-debug ;\ + docker run -v /home/docker/volumes/binpkgs:/var/cache/binpkgs --name gbuilder-debug -ti bash |