1
0
mirror of https://git.decapod.one/brethil/dotfiles synced 2024-11-23 12:01:30 +01:00

dev: update makefile with release target, update docs

This commit is contained in:
bretello 2020-12-08 23:46:24 +01:00
parent 4b3b12db5b
commit 34fd5a8726
Signed by: brethil
GPG Key ID: 876AAC6290170FE7
2 changed files with 31 additions and 16 deletions

View File

@ -11,7 +11,7 @@ RED="\033[31m"
BLUE="\033[34m" BLUE="\033[34m"
WHITE="\033[37m" WHITE="\033[37m"
.PHONY: test_colors clean list_targets build arch archlinux run .PHONY: clean list_targets build build-arch build-debian arch archlinux debian run ansible release
all: list_targets all: list_targets
@ -30,13 +30,28 @@ build-debian: Dockerfile.debian
build-arch: Dockerfile.archlinux build-arch: Dockerfile.archlinux
docker build -t brethil/dotfiles:dev -f Dockerfile.archlinux . docker build -t brethil/dotfiles:dev -f Dockerfile.archlinux .
run: build clean run: _run
docker run -d --name=dotfiles-dev -v ${PWD}/..:/root/.dotfiles brethil/dotfiles:dev echo -e ${GREEN} "***" ${CLEAR} Watching logs from the container. Hit Ctrl+C to stop watching.
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
docker logs -f dotfiles-dev docker logs -f dotfiles-dev
_run: Dockerfile.archlinux Dockerfile.debian build clean
docker run -d --name=dotfiles-dev -v ${PWD}/..:/root/.dotfiles brethil/dotfiles:dev
echo -en ${GREEN} "***" ${CLEAR} Started container, listening on
echo -e ${BOLD}${WHITE} `docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' dotfiles-dev`:22 ${CLEAR}
echo -e ${BLUE} "***" ${CLEAR} Run \`make clean\` to stop and remove the container
ansible: ../ansible/playbooks/setup.yml _run
ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook -i ansible-hosts -e local_development=true ../ansible/playbooks/setup.yml
release: build-arch ansible
docker commit -m "install and initialize dotfiles (ansible)" dotfiles-dev brethil/dotfiles:latest
docker tag brethil/dotfiles:latest brethil/dotfiles:`git rev-parse --short HEAD &2>/dev/null`
echo -e ${GREEN} "***" ${CLEAR} committed and tagged the \"dockerfiles-dev\" to brethil/dotfiles:latest and :`git rev-parse HEAD --short`
if ! git diff --quiet --exit-code; then \
docker tag brethil/dotfiles:latest brethil/dotfiles:dev && \
echo -e ${GREEN} "***" ${CLEAR} committed and tagged the \"dockerfiles-dev\" to brethil/dotfiles:dev; \
fi
clean: clean:
echo -e ${GREEN} "***" ${CLEAR} Stopping and removing \"dockerfiles-dev\" container... 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 kill dotfiles-dev &>/dev/null &>/dev/null && echo -e ${GREEN} "***" ${CLEAR} Killed container: dotfiles-dev || echo -e ${BLUE} "***" ${CLEAR} no containers to stop

View File

@ -13,7 +13,7 @@ make debian # this builds a docker image based on debian and runs it
Start a builder in one shell: Start a builder in one shell:
```bash ```bash
while true; do make; done while true; do make _run; done
``` ```
_check for the docker IP of the started container_. _check for the docker IP of the started container_.
@ -41,16 +41,16 @@ the local repository bind-mounted on `/root/.dotfiles`. To use a custom volume:
docker run -v <volume>:/root/dofiles` docker run -v <volume>:/root/dofiles`
``` ```
Ansible can now be used to test the installation.
```bash
# this will install dotfiles on the docker container
ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook -i ansible-hosts \
-e local_development=true \
../ansible/playbooks/setup.yml
```
**IMPORTANT** if bind-mounting an already existing repository, run **IMPORTANT** if bind-mounting an already existing repository, run
`ansible` with `-e local_development=true` to avoid `ansible` with `-e local_development=true` to avoid
clobbering the git history if you have unpushed commit (it won't clobbering the git history if you have unpushed commit (it won't
work if your repo is dirty). work if your repo is dirty).
Ansible can now be used to test the installation.
make ansible
## Releasing
Use `make release` to build an image from scratch, run it, install dotfiles
in the container using ansible, then commit the resulting container.