mirror of
https://git.decapod.one/brethil/dotfiles
synced 2024-11-21 19:11:30 +01:00
dev: add volumes to dockerfile
This commit is contained in:
parent
d6e1aac0f2
commit
74dcf328aa
|
@ -12,4 +12,5 @@ COPY id_ed25519.pub /root/.ssh/authorized_keys
|
||||||
|
|
||||||
WORKDIR /root/
|
WORKDIR /root/
|
||||||
COPY entrypoint.sh /
|
COPY entrypoint.sh /
|
||||||
|
VOLUME ["/root/.dotfiles"]
|
||||||
CMD ["bash", "/entrypoint.sh"]
|
CMD ["bash", "/entrypoint.sh"]
|
||||||
|
|
|
@ -13,4 +13,5 @@ COPY id_ed25519.pub /root/.ssh/authorized_keys
|
||||||
|
|
||||||
WORKDIR /root/
|
WORKDIR /root/
|
||||||
COPY entrypoint.sh /
|
COPY entrypoint.sh /
|
||||||
|
VOLUME ["/root/.dotfiles"]
|
||||||
CMD ["bash", "/entrypoint.sh"]
|
CMD ["bash", "/entrypoint.sh"]
|
||||||
|
|
|
@ -25,3 +25,32 @@ ansible-playbook -v -i ./ansible-hosts playbooks/setup.yml
|
||||||
```
|
```
|
||||||
|
|
||||||
note: the ip address in `ansible-hosts` might have changed from `172.18.0.2`.
|
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:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
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
|
||||||
|
`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).
|
||||||
|
|
Loading…
Reference in New Issue
Block a user