2020-12-07 19:45:06 +01:00
|
|
|
SHELL=/bin/bash
|
|
|
|
|
2020-12-08 18:17:20 +01:00
|
|
|
ifndef VERBOSE
|
|
|
|
.SILENT:
|
|
|
|
endif
|
|
|
|
|
|
|
|
CLEAR="\033[0m"
|
|
|
|
BOLD="\033[1m"
|
|
|
|
GREEN="\033[32m"
|
|
|
|
RED="\033[31m"
|
|
|
|
BLUE="\033[34m"
|
|
|
|
WHITE="\033[37m"
|
|
|
|
|
|
|
|
.PHONY: test_colors clean list_targets build arch archlinux run
|
|
|
|
|
2020-12-07 19:45:06 +01:00
|
|
|
all: list_targets
|
|
|
|
|
|
|
|
list_targets:
|
|
|
|
echo "List of targets:"
|
|
|
|
@grep '^[^#[:space:]].*:' Makefile
|
|
|
|
|
|
|
|
debian: clean build-debian run
|
|
|
|
arch archlinux: clean build-arch run
|
|
|
|
|
2020-12-08 18:17:20 +01:00
|
|
|
build: build-arch
|
|
|
|
|
|
|
|
build-debian: Dockerfile.debian
|
2020-12-07 19:45:06 +01:00
|
|
|
docker build -t brethil/dotfiles:dev -f Dockerfile.debian .
|
|
|
|
|
2020-12-08 18:17:20 +01:00
|
|
|
build-arch: Dockerfile.archlinux
|
2020-12-07 19:45:06 +01:00
|
|
|
docker build -t brethil/dotfiles:dev -f Dockerfile.archlinux .
|
|
|
|
|
2020-12-08 18:17:20 +01:00
|
|
|
run: build clean
|
|
|
|
docker run -d --name=dotfiles-dev -v ${PWD}/..:/root/.dotfiles brethil/dotfiles:dev
|
|
|
|
echo -en ${GREEN} "***" ${CLEAR} Started container, listening on ${BOLD}${WHITE}
|
|
|
|
echo -e ${msg} `docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' dotfiles-dev`:22 ${CLEAR}
|
|
|
|
echo -e ${GREEN} "***" ${CLEAR} Watching logs from the container. Hit Ctrl+C to stop watching. Run \`make clean\` to stop and remove the container
|
2020-12-07 19:45:06 +01:00
|
|
|
docker logs -f dotfiles-dev
|
|
|
|
|
|
|
|
clean:
|
2020-12-08 18:17:20 +01:00
|
|
|
echo -e ${GREEN} "***" ${CLEAR} Stopping and removing \"dockerfiles-dev\" container...
|
|
|
|
docker kill dotfiles-dev &>/dev/null &>/dev/null && echo -e ${GREEN} "***" ${CLEAR} Killed container: dotfiles-dev || echo -e ${BLUE} "***" ${CLEAR} no containers to stop
|
|
|
|
docker rm dotfiles-dev &>/dev/null && echo -e ${GREEN} "***" ${CLEAR} Removed container: dotfiles-dev || echo -e ${BLUE} "***" ${CLEAR} no containers to remove
|