-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.erb
82 lines (63 loc) · 2.6 KB
/
Dockerfile.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# vi: ft=Dockerfile
FROM debian:buster
# Locales
ENV LANG=en_US.UTF-8
RUN apt-get update && apt-get install -y locales
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen
RUN locale-gen en_US.UTF-8
# Colors and italics for tmux
COPY xterm-256color-italic.terminfo /root
RUN tic /root/xterm-256color-italic.terminfo
ENV TERM=xterm-256color-italic
# Common packages
RUN apt-get update
RUN apt-get install -y <%= tools_for_source("apt").keys.join(" ") -%>
SHELL ["/bin/bash", "-c"]
WORKDIR /root
# install neovim
WORKDIR /root/.local/bin/nvim
RUN curl -LO https://github.com/neovim/neovim/releases/download/stable/nvim.appimage
RUN chmod u+x nvim.appimage
RUN ./nvim.appimage --appimage-extract
# asdf
WORKDIR /root
COPY tool-versions /root/.tool-versions
RUN git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.8.0
RUN echo -e '\n. $HOME/.asdf/asdf.sh' >> ~/.bashrc
RUN echo -e '\n. $HOME/.asdf/completions/asdf.bash' >> ~/.bashrc
<% tools_for_source("asdf").each do |tool, config| %>
<% if config["apt_dependencies"] %>
RUN apt-get install -y <%= config["apt_dependencies"].join(" ") -%>
<% end -%>
RUN /root/.asdf/bin/asdf plugin-add <%= tool -%>
<% if config["pre_install_commands"] -%>
<% config["pre_install_commands"].each do |cmd| %>
RUN /bin/bash <%= cmd -%>
<% end -%>
<% end -%>
<% config["asdf"]["versions"].each do |version| %>
RUN PATH=/root/.asdf/bin:$PATH asdf install <%= tool -%> <%= version -%>
<% end -%>
<% end -%>
<% package_configs.each do |pc| %>
<% pc["install_list"].each do |package| %>
RUN PATH=/root/.asdf/shims:/root/.asdf/bin:$PATH <%= pc["install_command"] -%> <%= package -%>
<% end -%>
<% end -%>
RUN PATH=/root/.asdf/shims:/root/.asdf/bin:$PATH asdf reshim
# Dotfiles 😎
WORKDIR /root/dotfiles
COPY dotfiles /root/dotfiles
# don't install nvim plugins yet; the rake task shells out, and we need to
# define a "nvim" function to run the AppImage.
RUN PATH=/root/.asdf/shims:/root/.asdf/bin:$PATH rake scripts:install configs:install docker_env:install
# now that aliases_shared has been installed, we can define the "nvim"
# function.
RUN printf "nvim() {\n /root/.local/bin/nvim/squashfs-root/AppRun \"\$@\"\n}\n" >> ~/.aliases_shared
# update commands in rake task to source the function we just defined
RUN sed -i 's/bash -c/BASH_ENV=~\/.aliases_shared bash -c/g' /root/dotfiles/Rakefile
RUN PATH=/root/.asdf/shims:/root/.asdf/bin:$PATH rake plugins:install
RUN echo . $HOME/.asdf/asdf.sh >> ~/.aliases_shared
RUN /bin/zsh -c 'printf "fpath=(${HOME}/.asdf/completions ${fpath})\nautoload -Uz compinit\ncompinit" >> ~/.zshrc'
WORKDIR /root
CMD /bin/bash -i -c "tmux-start dev"