Skip to content

Commit

Permalink
[dotbox] Add Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
mikybars committed Mar 5, 2020
1 parent 494794e commit bcf5514
Show file tree
Hide file tree
Showing 5 changed files with 108 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# mperezi/dotfiles

> 🐳 A [dockerized version](https://github.com/mperezi/dotfiles/tree/master/dotbox) of these dotfiles is available for a quick try!
## Installation

```bash
Expand Down
2 changes: 2 additions & 0 deletions dotbox/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!install_custom.sh
21 changes: 21 additions & 0 deletions dotbox/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM alpine:3.10

LABEL maintainer="Miguel Pérez <https://github.com/mperezi>"

ENV TERM xterm-256color

RUN apk add --no-cache \
git curl less bash zsh vim python3 \
zsh-vcs fzf docker-cli && \
rm -rf /usr/share/vim/vim*/doc && \
find /usr/lib/python3* -type d -name __pycache__ | xargs rm -rf
RUN ln -sf /usr/bin/python3 /usr/bin/python

COPY install_custom.sh /usr/bin/install_custom.sh
RUN /usr/bin/install_custom.sh

RUN bash -c "$(curl -sL https://raw.githubusercontent.com/mperezi/dotfiles/master/install.sh)" && \
find $HOME/.dotfiles -type d -name .git | xargs rm -rf && \
rm -rf $HOME/.dotfiles/macos

CMD ["/bin/zsh"]
29 changes: 29 additions & 0 deletions dotbox/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# dotbox

> Run a full-fledged dotfiles environment with a single command
## Features

- Based on Alpine Linux
- Zsh (+syntax-highlighting +autosuggestions)
- Vim 8 (+linters +git)
- Git
- fzf (+history-bindings)
- Docker CLI
- Awesome tools: autojump, bat, fd, ripgrep
- Lightweight: just under 200 MB!

## Usage

```bash
$ docker run \
--rm -it \
-v /var/run/docker.sock:/var/run/docker.sock \
-v dotbox-data:/root/.local \
mperezi/dotbox:latest
```

Please note that:

* You can run Docker commands _on the host_ by mounting the unix socket exposed by your Docker daemon and available through /var/run/docker.sock.
* As Docker containers are stateless by default, data generated in a session like shell history or the autojump database would be lost when you exit the shell and therefore the container ceases to exist. You can use a named volume (e.g. dotbox-data) to persist this data across sessions.
54 changes: 54 additions & 0 deletions dotbox/install_custom.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/usr/bin/env bash

set -euo pipefail

RIPGREP_RELEASE_URL="https://github.com/BurntSushi/ripgrep/releases/download/11.0.2/ripgrep-11.0.2-x86_64-unknown-linux-musl.tar.gz"
TAG_RELEASE_URL="https://github.com/aykamko/tag/releases/download/v1.4.0/tag_linux_386.tar.gz"
BAT_RELEASE_URL="https://github.com/sharkdp/bat/releases/download/v0.12.1/bat-v0.12.1-x86_64-unknown-linux-musl.tar.gz"
FD_RELEASE_URL="https://github.com/sharkdp/fd/releases/download/v7.4.0/fd-v7.4.0-x86_64-unknown-linux-musl.tar.gz"

install_autojump() {
echo "Installing autojump..."
cd /tmp
git clone git://github.com/wting/autojump.git
cd autojump
SHELL=$(command -v zsh) ./install.py -s
}

install_ripgrep() {
echo "Installing ripgrep..."
curl -sL $RIPGREP_RELEASE_URL |
tar xvzf - \
-C /usr/local/bin \
--strip-components=1 \
ripgrep-11.0.2-x86_64-unknown-linux-musl/rg
}

install_tag() {
echo "Installing tag..."
curl -sL $TAG_RELEASE_URL | tar xvzf - -C /usr/local/bin tag
}

install_bat() {
echo "Installing bat..."
curl -sL $BAT_RELEASE_URL |
tar xvzf - \
-C /usr/local/bin \
--strip-components=1 \
bat-v0.12.1-x86_64-unknown-linux-musl/bat
}

install_fd() {
echo "Installing fd..."
curl -sL $FD_RELEASE_URL |
tar xvzf - \
-C /usr/local/bin \
--strip-components=1 \
fd-v7.4.0-x86_64-unknown-linux-musl/fd
}

install_autojump
install_ripgrep
install_tag
install_bat
install_fd

0 comments on commit bcf5514

Please sign in to comment.