Skip to content

Commit

Permalink
Migrate to single setup file, inspired by tailscale setup script
Browse files Browse the repository at this point in the history
  • Loading branch information
galkk committed Nov 26, 2024
1 parent 10d2f7c commit 4ee29df
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 134 deletions.
17 changes: 7 additions & 10 deletions .github/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,10 @@ Configuration:
- [Dockerfile](setup/Dockerfile)
- [Docker compose](setup/docker-compose.yml)

| Action | Minimal |
| ----------------------------------- | --------------------------------------------------------------------------------------------------------------- |
| Run from repository, docker | `docker run --rm -it galkkk/dotfiles:minimal` |
| Run from repository, docker compose | `docker compose run --rm dotfiles:minimal` |
| Build | `sudo docker buildx build --build-context setupscripts=setup --target minimal --tag dotfiles:minimal setup` |
| Run locally | `docker run -it docker.io/library/dotfiles:minimal` |
| Push to repository | <code>docker tag dotfiles:minimal galkkk/dotfiles:minimal <br>docker image push galkkk/dotfiles:minimal </code> |

TODO: Figure out if it is possible to move setup files to subdirectory and real dotfiles *into* parent directory.
That will require figuring out build context and may be not possible in general case. Unless I will figure out sub repositories or docker contexts, then it will work.
| Action | Minimal |
| ----------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| Run from repository, docker | `docker run --rm -it galkkk/dotfiles:minimal` |
| Run from repository, docker compose | `docker compose run --rm dotfiles:minimal` |
| Build | `docker buildx build --build-context setupscripts=setup --target minimal --tag dotfiles:minimal --file setup/Dockerfile --progress=plain --no-cache .` |
| Run locally | `docker run -it docker.io/library/dotfiles:minimal` |
| Push to repository | <code>docker tag dotfiles:minimal galkkk/dotfiles:minimal <br>docker image push galkkk/dotfiles:minimal </code> |
2 changes: 1 addition & 1 deletion .zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ zstyle ':autocomplete:*' widget-style menu-select
zstyle ':autocomplete:*' list-lines 16
zstyle ':autocomplete:*' fzf-completion yes

zstyle ':completion:*:*' matcher-list 'm:{[:lower:]-}={[:upper:]_}' '+r:|[.]=**'
zstyle ':completion:*:*' matcher-list 'm:{[:lower:]-}={[:upper:]_}' '+r:|[.]=**'

bindkey '^I' menu-complete
bindkey "$terminfo[kcbt]" reverse-menu-complete
Expand Down
8 changes: 0 additions & 8 deletions setup/1-base.sh

This file was deleted.

19 changes: 0 additions & 19 deletions setup/2-minimal-config.sh

This file was deleted.

11 changes: 0 additions & 11 deletions setup/3-dev.sh

This file was deleted.

30 changes: 0 additions & 30 deletions setup/4-gui-fonts.sh

This file was deleted.

12 changes: 0 additions & 12 deletions setup/4-gui.sh

This file was deleted.

10 changes: 0 additions & 10 deletions setup/5-personal.sh

This file was deleted.

21 changes: 0 additions & 21 deletions setup/6-personal-gui.sh

This file was deleted.

15 changes: 3 additions & 12 deletions setup/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,14 @@ FROM ubuntu:rolling AS minimal
COPY . /root/

# Using bind mount to not copy installation scripts to the container
RUN --mount=from=setupscripts,dst=/setupscripts/ /setupscripts/1-base.sh && /setupscripts/2-minimal-config.sh
RUN --mount=from=setupscripts,dst=/setupscripts/ /setupscripts/setup.sh

WORKDIR /root/
CMD ["/bin/zsh"]

# Stage 2 - full image
FROM minimal as full

RUN --mount=from=setupscripts,dst=/setupscripts/ /setupscripts/3-dev.sh && /setupscripts/5-personal.sh
RUN --mount=from=setupscripts,dst=/setupscripts/ /setupscripts/setup.sh dev

CMD ["/bin/zsh"]

# Stage 3 - gui image
FROM full as gui

ENV DEBIAN_FRONTEND=noninteractive

RUN --mount=from=setupscripts,dst=/setupscripts/ /setupscripts/4-gui.sh && /setupscripts/4-gui-fonts.sh && /setupscripts/6-personal-gui.sh

CMD ["/bin/zsh"]
CMD ["/bin/zsh"]

0 comments on commit 4ee29df

Please sign in to comment.