-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
135 lines (107 loc) · 2.9 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
FROM node:10-alpine as builder
# YouCompleteMe dependencies
RUN apk --no-cache add --virtual build-deps \
curl \
git \
build-base \
ncurses-dev \
cmake \
python-dev
# vim + python
RUN cd /opt/ \
&& git clone https://github.com/vim/vim.git \
&& cd ./vim/ \
&& ./configure \
--disable-gui \
--disable-netbeans \
--enable-multibyte \
--enable-pythoninterp \
--with-features=huge \
--with-python-config-dir=/usr/lib/python2.7/config \
&& make \
&& make install
# user config (already created by parent image)
ENV UID="1000" \
GID="1000" \
UHOME=/home/node
# init vim folder
RUN mkdir -p $UHOME/.vim/plugged
# install manually some plugins
# Vim plugin manager
RUN curl -fLo $UHOME/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
# YouCompleteMe
RUN cd $UHOME/.vim/plugged \
&& git clone --depth 1 https://github.com/Valloric/YouCompleteMe \
&& cd YouCompleteMe \
&& git submodule update --init --recursive \
&& $UHOME/.vim/plugged/YouCompleteMe/install.py --js-completer
# tern
RUN cd $UHOME/.vim/plugged \
&& git clone https://github.com/ternjs/tern_for_vim.git \
&& cd tern_for_vim \
&& npm install
# vimproc
RUN cd $UHOME/.vim/plugged \
&& git clone https://github.com/Shougo/vimproc.vim.git \
&& cd vimproc.vim \
&& make
# theme
RUN cd $UHOME/.vim/plugged \
&& git clone https://github.com/morhetz/gruvbox.git
# Cleanup
RUN apk del build-deps \
&& rm -rf \
$UHOME/bundle/YouCompleteMe/third_party/ycmd/clang_includes \
$UHOME/bundle/YouCompleteMe/third_party/ycmd/cpp \
/var/cache/* \
/var/log/* \
/var/tmp/* \
&& mkdir /var/cache/apk
# build finale image
FROM shenron/yarn:latest
USER root
# user config (already created by parent image)
ENV UID="1000" \
GID="1000" \
UHOME=/home/node
# retrieve only wanted binaries
COPY --from=builder /usr/local/bin/ /usr/local/bin
COPY --from=builder /usr/local/share/vim/ /usr/local/share/vim/
COPY --from=builder $UHOME/.vim /$UHOME/.vim
RUN apk --no-cache add \
bash \
git \
ctags \
python \
ncurses \
editorconfig \
screen
# install npm dependencies
# for tagbar vim plugin
RUN npm install -g \
git+https://github.com/shenron/jsctags \
git+https://github.com/Perlence/tstags.git \
flow-bin
# fix home folder rights
RUN chown $UID:$GID -R $UHOME
# before the install of all other plugins, set user with good $PATH
USER node
# add "hello" banner
ADD banner.txt $UHOME/banner.txt
# add bashrc prompt
ADD bashrc $UHOME/.bashrc
# add global editorconfig
ADD editorconfig $UHOME/.editorconfig
# add global tern-project config
ADD tern-project $UHOME/.tern-project
# create folder for vim sessions
RUN mkdir $UHOME/.vim/sessions/
# add vim conf
ADD vimrc $UHOME/.vim
RUN ln -s $UHOME/.vim/vimrc $UHOME/.vimrc
# install all vim plugins
RUN vim +PlugInstall +qall
ENV TERM=xterm-256color
CMD ["/bin/bash", "-c", "vim"]
WORKDIR $UHOME/app