This repository has been archived by the owner on Sep 25, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 80
/
Dockerfile
171 lines (156 loc) · 5.88 KB
/
Dockerfile
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
FROM jare/alpine-vim:latest
# User config
ENV UID="1000" \
UNAME="developer" \
GID="1000" \
GNAME="developer" \
SHELL="/bin/bash" \
UHOME=/home/developer
# Used to configure YouCompleteMe
ENV GOROOT="/usr/lib/go"
ENV GOBIN="$GOROOT/bin"
ENV GOPATH="$UHOME/workspace"
ENV PATH="$PATH:$GOBIN:$GOPATH/bin"
# User
RUN apk --no-cache add sudo \
# Create HOME dir
&& mkdir -p "${UHOME}" \
&& chown "${UID}":"${GID}" "${UHOME}" \
# Create user
&& echo "${UNAME}:x:${UID}:${GID}:${UNAME},,,:${UHOME}:${SHELL}" \
>> /etc/passwd \
&& echo "${UNAME}::17032:0:99999:7:::" \
>> /etc/shadow \
# No password sudo
&& echo "${UNAME} ALL=(ALL) NOPASSWD: ALL" \
> "/etc/sudoers.d/${UNAME}" \
&& chmod 0440 "/etc/sudoers.d/${UNAME}" \
# Create group
&& echo "${GNAME}:x:${GID}:${UNAME}" \
>> /etc/group
# Install Pathogen
RUN apk --no-cache add curl \
&& mkdir -p \
$UHOME/bundle \
$UHOME/.vim/autoload \
$UHOME/.vim_runtime/temp_dirs \
&& curl -LSso \
$UHOME/.vim/autoload/pathogen.vim \
https://tpo.pe/pathogen.vim \
&& echo "execute pathogen#infect('$UHOME/bundle/{}')" \
> $UHOME/.vimrc \
&& echo "syntax on " \
>> $UHOME/.vimrc \
&& echo "filetype plugin indent on " \
>> $UHOME/.vimrc \
# Cleanup
&& apk del curl
# Vim wrapper
COPY run /usr/local/bin/
#custom .vimrc stub
RUN mkdir -p /ext && echo " " > /ext/.vimrc
COPY .vimrc $UHOME/my.vimrc
COPY .bashrc $UHOME/.bashrc
# Vim plugins deps
RUN apk --update add \
bash \
ctags \
curl \
git \
ncurses-terminfo \
python \
# YouCompleteMe
&& apk add --virtual build-deps \
build-base \
cmake \
go \
llvm \
perl \
python-dev \
&& git clone --depth 1 https://github.com/Valloric/YouCompleteMe \
$UHOME/bundle/YouCompleteMe/ \
&& cd $UHOME/bundle/YouCompleteMe \
&& git submodule update --init --recursive \
&& $UHOME/bundle/YouCompleteMe/install.py --gocode-completer \
# Install and compile procvim.vim
&& git clone --depth 1 https://github.com/Shougo/vimproc.vim \
$UHOME/bundle/vimproc.vim \
&& cd $UHOME/bundle/vimproc.vim \
&& make \
&& chown $UID:$GID -R $UHOME \
# Cleanup
&& apk del build-deps \
&& apk add \
libxt \
libx11 \
libstdc++ \
&& rm -rf \
$UHOME/bundle/YouCompleteMe/third_party/ycmd/clang_includes \
$UHOME/bundle/YouCompleteMe/third_party/ycmd/cpp \
/usr/lib/go \
/var/cache/* \
/var/log/* \
/var/tmp/* \
&& mkdir /var/cache/apk
USER $UNAME
# Plugins
RUN cd $UHOME/bundle/ \
&& git clone --depth 1 https://github.com/pangloss/vim-javascript \
&& git clone --depth 1 https://github.com/scrooloose/nerdcommenter \
&& git clone --depth 1 https://github.com/godlygeek/tabular \
&& git clone --depth 1 https://github.com/Raimondi/delimitMate \
&& git clone --depth 1 https://github.com/nathanaelkane/vim-indent-guides \
&& git clone --depth 1 https://github.com/groenewege/vim-less \
&& git clone --depth 1 https://github.com/othree/html5.vim \
&& git clone --depth 1 https://github.com/elzr/vim-json \
&& git clone --depth 1 https://github.com/bling/vim-airline \
&& git clone --depth 1 https://github.com/easymotion/vim-easymotion \
&& git clone --depth 1 https://github.com/mbbill/undotree \
&& git clone --depth 1 https://github.com/majutsushi/tagbar \
&& git clone --depth 1 https://github.com/vim-scripts/EasyGrep \
&& git clone --depth 1 https://github.com/jlanzarotta/bufexplorer \
&& git clone --depth 1 https://github.com/kien/ctrlp.vim \
&& git clone --depth 1 https://github.com/scrooloose/nerdtree \
&& git clone --depth 1 https://github.com/jistr/vim-nerdtree-tabs \
&& git clone --depth 1 https://github.com/scrooloose/syntastic \
&& git clone --depth 1 https://github.com/tomtom/tlib_vim \
&& git clone --depth 1 https://github.com/marcweber/vim-addon-mw-utils \
&& git clone --depth 1 https://github.com/vim-scripts/taglist.vim \
&& git clone --depth 1 https://github.com/terryma/vim-expand-region \
&& git clone --depth 1 https://github.com/tpope/vim-fugitive \
&& git clone --depth 1 https://github.com/airblade/vim-gitgutter \
&& git clone --depth 1 https://github.com/fatih/vim-go \
&& git clone --depth 1 https://github.com/plasticboy/vim-markdown \
&& git clone --depth 1 https://github.com/michaeljsmith/vim-indent-object \
&& git clone --depth 1 https://github.com/terryma/vim-multiple-cursors \
&& git clone --depth 1 https://github.com/tpope/vim-repeat \
&& git clone --depth 1 https://github.com/tpope/vim-surround \
&& git clone --depth 1 https://github.com/vim-scripts/mru.vim \
&& git clone --depth 1 https://github.com/vim-scripts/YankRing.vim \
&& git clone --depth 1 https://github.com/tpope/vim-haml \
&& git clone --depth 1 https://github.com/SirVer/ultisnips \
&& git clone --depth 1 https://github.com/honza/vim-snippets \
&& git clone --depth 1 https://github.com/derekwyatt/vim-scala \
&& git clone --depth 1 https://github.com/christoomey/vim-tmux-navigator \
&& git clone --depth 1 https://github.com/ekalinin/Dockerfile.vim \
# Theme
&& git clone --depth 1 \
https://github.com/altercation/vim-colors-solarized
# Build default .vimrc
RUN mv -f $UHOME/.vimrc $UHOME/.vimrc~ \
&& curl -s \
https://raw.githubusercontent.com/amix/vimrc/master/vimrcs/basic.vim \
>> $UHOME/.vimrc~ \
&& curl -s \
https://raw.githubusercontent.com/amix/vimrc/master/vimrcs/extended.vim \
>> $UHOME/.vimrc~ \
&& cat $UHOME/my.vimrc \
>> $UHOME/.vimrc~ \
&& rm $UHOME/my.vimrc \
&& sed -i '/colorscheme peaksea/d' $UHOME/.vimrc~
# Pathogen help tags generation
RUN vim -E -c 'execute pathogen#helptags()' -c q ; return 0
ENV TERM=xterm-256color
# List of Vim plugins to disable
ENV DISABLE=""
ENTRYPOINT ["sh", "/usr/local/bin/run"]