-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathDockerfile
102 lines (90 loc) · 3.67 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
FROM alpine:latest as builder
WORKDIR /mnt/build/ctags
RUN apk --no-cache add \
git \
xfce4-dev-tools \
build-base
RUN \
git clone https://github.com/universal-ctags/ctags \
&& cd ctags \
&& ./autogen.sh \
&& ./configure --prefix=/usr/local \
&& make \
&& make install
FROM alpine:latest
LABEL \
maintainer="[email protected]" \
url.github="https://github.com/nicodebo/neovim-docker" \
url.dockerhub="https://hub.docker.com/r/nicodebo/neovim-docker/"
ENV \
UID="1000" \
GID="1000" \
UNAME="neovim" \
GNAME="neovim" \
SHELL="/bin/bash" \
WORKSPACE="/mnt/workspace" \
NVIM_CONFIG="/home/neovim/.config/nvim" \
NVIM_PCK="/home/neovim/.local/share/nvim/site/pack" \
ENV_DIR="/home/neovim/.local/share/vendorvenv" \
NVIM_PROVIDER_PYLIB="python3_neovim_provider" \
PATH="/home/neovim/.local/bin:${PATH}"
COPY --from=builder /usr/local/bin/ctags /usr/local/bin
RUN \
# install packages
apk --no-cache add \
# needed by neovim :CheckHealth to fetch info
curl \
# needed to change uid and gid on running container
shadow \
# needed to install apk packages as neovim user on the container
sudo \
# needed to switch user
su-exec \
# needed for neovim python3 support
python3 \
# needed for pipsi
py3-virtualenv \
# text editor
neovim \
neovim-doc \
fzf \
# needed by fzf because the default shell does not support fzf
bash \
# install build packages
&& apk --no-cache add --virtual build-dependencies \
python3-dev \
gcc \
musl-dev \
git \
# create user
&& addgroup "${GNAME}" \
&& adduser -D -G "${GNAME}" -g "" -s "${SHELL}" "${UNAME}" \
&& echo "${UNAME} ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers \
# install neovim python3 provider
&& sudo -u ${UNAME} python3 -m venv "${ENV_DIR}/${NVIM_PROVIDER_PYLIB}" \
&& "${ENV_DIR}/${NVIM_PROVIDER_PYLIB}/bin/pip" install pynvim \
# install pipsi and python language server
&& curl https://raw.githubusercontent.com/mitsuhiko/pipsi/master/get-pipsi.py | sudo -u ${UNAME} python3 \
&& sudo -u ${UNAME} pipsi install python-language-server \
# install plugins
&& mkdir -p "${NVIM_PCK}/common/start" "${NVIM_PCK}/filetype/start" "${NVIM_PCK}/colors/opt" \
&& git -C "${NVIM_PCK}/common/start" clone --depth 1 https://github.com/tpope/vim-commentary \
&& git -C "${NVIM_PCK}/common/start" clone --depth 1 https://github.com/junegunn/fzf.vim \
&& git -C "${NVIM_PCK}/common/start" clone --depth 1 https://github.com/tpope/vim-surround \
&& git -C "${NVIM_PCK}/common/start" clone --depth 1 https://github.com/tpope/vim-obsession \
&& git -C "${NVIM_PCK}/common/start" clone --depth 1 https://github.com/yuttie/comfortable-motion.vim \
&& git -C "${NVIM_PCK}/common/start" clone --depth 1 https://github.com/wellle/targets.vim \
&& git -C "${NVIM_PCK}/common/start" clone --depth 1 https://github.com/SirVer/ultisnips \
&& git -C "${NVIM_PCK}/filetype/start" clone --depth 1 https://github.com/mattn/emmet-vim \
&& git -C "${NVIM_PCK}/filetype/start" clone --depth 1 https://github.com/lervag/vimtex \
&& git -C "${NVIM_PCK}/filetype/start" clone --depth 1 https://github.com/captbaritone/better-indent-support-for-php-with-html \
&& git -C "${NVIM_PCK}/colors/opt" clone --depth 1 https://github.com/fxn/vim-monochrome \
&& git -C "${NVIM_PCK}/common/start" clone --depth 1 https://github.com/autozimu/LanguageClient-neovim \
&& cd "${NVIM_PCK}/common/start/LanguageClient-neovim/" && sh install.sh \
&& chown -R ${UNAME}:${GNAME} /home/neovim/.local \
# remove build packages
&& apk del build-dependencies
COPY entrypoint.sh /usr/local/bin/
VOLUME "${WORKSPACE}"
VOLUME "${NVIM_CONFIG}"
ENTRYPOINT ["sh", "/usr/local/bin/entrypoint.sh"]