-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.ubuntu2004
188 lines (154 loc) · 4.71 KB
/
Dockerfile.ubuntu2004
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
FROM ubuntu:20.04
ARG USER=shank
ARG PASSWD=pass
ARG UID=1000
ARG GID=1000
ENV USER=${USER}
ENV HOME=/home/${USER}
# to fix tzdata hanging up the build process
ENV DEBIAN_FRONTEND=noninteractive
# better colors
ENV TERM=xterm-256color
# update, upgrade
RUN apt-get update && apt-get upgrade -y && apt-get autoremove -y
# locales
# source: https://serverfault.com/a/801162
ENV LANG=en_US.UTF-8
RUN apt-get install -y locales \
&& sed -i -e "s/# $LANG.*/$LANG UTF-8/" /etc/locale.gen \
&& dpkg-reconfigure --frontend=noninteractive locales \
&& update-locale LANG=$LANG
# timezone
RUN apt-get install -yq tzdata \
&& mv /etc/localtime /etc/localtime.bak \
&& ln -s /usr/share/zoneinfo/America/Indianapolis /etc/localtime \
&& dpkg-reconfigure -f noninteractive tzdata
ENV TZ="America/Indianapolis"
# apt-utils will be useful
RUN apt-get install -y apt-utils \
&& apt-get autoremove -y
# install sudo
RUN apt-get install -y sudo \
&& apt-get autoremove -y
# unminimize since this is a dev container
RUN yes | unminimize
# install newer nodejs
ENV NODE_MAJOR=20
RUN apt-get install -y gpg curl \
&& mkdir -p /etc/apt/keyrings \
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_${NODE_MAJOR}.x nodistro main" > /etc/apt/sources.list.d/nodesource.list \
&& apt-get update -y \
&& apt-get install -y nodejs \
&& apt-get autoremove -y
# dev packages
RUN apt-get install -y \
apt-file \
autoconf \
bat \
bfs \
black \
clang \
clang-format \
cmake \
curl \
file \
g++ \
gcc \
gettext \
git \
htop \
lld \
make \
neofetch \
ninja-build \
pipx \
python-is-python3 \
python3 \
python3-pip \
python3-venv \
ripgrep \
software-properties-common \
stow \
tmux \
tree \
unzip \
universal-ctags \
wget \
xclip \
xsel \
zip \
&& apt-get autoremove -y
# bat -> batcat
RUN ln -s /usr/bin/batcat /usr/bin/bat
# fd -> fdfind
RUN ln -s /usr/bin/fdfind /usr/bin/fd
# fish shell
RUN add-apt-repository ppa:fish-shell/release-3 && \
apt-get update && \
apt-get install -y fish && \
apt-get autoremove -y
# # helix
# RUN add-apt-repository ppa:maveonair/helix-editor \
# && apt-get update \
# && apt-get install -y helix \
# && apt-get autoremove -y
# crate user
RUN useradd --create-home ${USER} --uid ${UID} --shell /usr/bin/bash && \
echo "${USER}:${PASSWD}" | chpasswd && \
echo "${USER} ALL=(ALL) ALL" >> /etc/sudoers
RUN echo "${USER}:${PASSWD}" | chpasswd
RUN chown -R ${USER} /home/${USER}
# change users default shell
RUN chsh ${USER} --shell /usr/bin/fish
# change to $USER directory
WORKDIR /home/${USER}
USER ${USER}
# fzf
RUN git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf && \
/home/${USER}/.fzf/install --all
# rust
# https://github.com/rust-lang/rustup/issues/297#issuecomment-444818896
RUN mkdir -p /home/${USER}/.config/fish/conf.d
RUN /usr/bin/bash -c 'curl https://sh.rustup.rs -sSf | sh -s -- -y'
# RUN mkdir ~/.cargo-target
# install rust (using rustup)
RUN /usr/bin/bash --login -c 'rustup install nightly stable'
RUN /usr/bin/bash --login -c 'rustup default nightly'
# cargo utils
RUN /usr/bin/bash --login -c 'cargo install stylua sd exa tealdeer procs tokei difftastic tree-sitter-cli'
# dotfiles
RUN git clone https://gitlab.com/shank/dotfiles.git \
&& cd dotfiles \
&& git remote set-url origin [email protected]:shank/dotfiles.git
# stow packages
RUN cd dotfiles \
&& rm --force ${HOME}/.config/fish/functions/fish_user_key_bindings.fish \
&& stow --verbose --no-folding fish neovim tmux bins git helix gdb yazi neovim
# tmux plugin manager
RUN git clone https://github.com/tmux-plugins/tpm $HOME/.tmux/plugins/tpm
# asdf-vm
# RUN git clone https://github.com/asdf-vm/asdf.git $HOME/.asdf --branch v0.10.2
# fish prompt
USER root
RUN /home/${USER}/.cargo/bin/sd -s "'>'" "' |'" /usr/share/fish/functions/fish_prompt.fish
RUN /home/${USER}/.cargo/bin/sd -s "'#'" "' #'" /usr/share/fish/functions/fish_prompt.fish
USER ${USER}
# change the shell for the rest of the commands commands
SHELL ["/usr/bin/fish", "--login", "-c"]
# fisher (fish shell)
RUN curl -sL https://git.io/fisher | source && fisher install jorgebucaran/fisher
RUN fisher install patrickf1/fzf.fish jethrokuan/z
# python packages
RUN pip install bpython
# copy nix installation script
COPY scripts/setup/nix.sh .
COPY scripts/setup/nix_pkgs.sh .
USER root
RUN chown $USER:$USER nix.sh nix_pkgs.sh
USER ${USER}
# after starting container, use nix for installing
# - neovim
# - lazygit
# start fish shell
# ENTRYPOINT ["fish"]