1
0
mirror of https://git.decapod.one/brethil/dotfiles synced 2024-12-22 23:31:32 +01:00
dotfiles/dev
2020-12-08 22:46:36 +01:00
..
add_community_general.sh install: use ansible 2020-12-08 00:36:08 +01:00
ansible-hosts install: use ansible 2020-12-08 00:36:08 +01:00
Dockerfile.archlinux dev: add volumes to dockerfile 2020-12-08 22:46:36 +01:00
Dockerfile.debian dev: add volumes to dockerfile 2020-12-08 22:46:36 +01:00
entrypoint.sh install: use ansible 2020-12-08 00:36:08 +01:00
id_ed25519.pub install: use ansible 2020-12-08 00:36:08 +01:00
Makefile dev: improve makefile log readability 2020-12-08 22:46:36 +01:00
README.md dev: add volumes to dockerfile 2020-12-08 22:46:36 +01:00

dev

This directory contains some useful dockerfiles/makefiles that can be used to test the deployment ansible playbooks.

make arch # this builds a docker image based on archlinux and runs it
make debian # this builds a docker image based on debian and runs it

Workflow

Start a builder in one shell:

while true; do make; done

check for the docker IP of the started container.

Test the playbook in another shell:

ansible-playbook -v -i ./ansible-hosts playbooks/setup.yml

note: the ip address in ansible-hosts might have changed from 172.18.0.2.

Docker images

  • Build: make build-arch or make build-debian to build the image.
  • Run: make run to run the docker container. This bind-mounts ../ to /root/.dotfiles, making it possible to test the repo in the container.

Docker + Ansible

Run dotfiles-dev image using make run. This starts the container with the local repository bind-mounted on /root/.dotfiles. To use a custom volume:

docker run -v <volume>:/root/dofiles`

Ansible can now be used to test the installation.

# 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 ansible with -e local_development=true to avoid clobbering the git history if you have unpushed commit (it won't work if your repo is dirty).