-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Dockerfile.ubuntu
106 lines (82 loc) · 2.54 KB
/
Dockerfile.ubuntu
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
ARG BASE_IMAGE
FROM $BASE_IMAGE AS base
SHELL [ "/bin/bash", "-c" ]
WORKDIR /workspace
ARG APT_PROXY
ARG TARGETPLATFORM
RUN <<EOF
if [[ -n "$APT_PROXY" ]]; then
sed -i "s|http://.*.ubuntu.com|$APT_PROXY|g" /etc/apt/sources.list
fi
apt-get update
apt-get install -y tar coreutils curl unzip
EOF
ENV NVIM_TAR=/workspace/nvim-linux64.tar.gz
ARG VERSION=master
ARG GH_PROXY
RUN <<EOF
curl -Lo $NVIM_TAR "${GH_PROXY:+$GH_PROXY/}https://github.com/neovim/neovim/releases/download/$VERSION/nvim-linux64.tar.gz"
curl -Lo "${NVIM_TAR}.sha256sum" "${GH_PROXY:+$GH_PROXY/}https://github.com/neovim/neovim/releases/download/$VERSION/nvim-linux64.tar.gz.sha256sum"
sha256sum "${NVIM_TAR}"
tar xzvf "${NVIM_TAR}"
EOF
RUN <<EOF
curl -Lo $NVIM_TAR "${GH_PROXY:+$GH_PROXY/}https://github.com/neovim/neovim/releases/download/$VERSION/nvim-linux64.tar.gz"
curl -Lo "${NVIM_TAR}.sha256sum" "${GH_PROXY:+$GH_PROXY/}https://github.com/neovim/neovim/releases/download/$VERSION/nvim-linux64.tar.gz.sha256sum"
sha256sum "${NVIM_TAR}"
tar xzvf "${NVIM_TAR}"
EOF
RUN <<EOF
echo "TARGETPLATFORM=$TARGETPLATFORM"
case "$TARGETPLATFORM" in
linux/amd64)
meta_type=amd64
tini_type=amd64
;;
linux/arm64)
meta_type=arm64
tini_type=arm64
;;
linux/arm/v*)
meta_type=armv7
tini_type=armhf
;;
*)
meta_type=unknown-arch
tini_type=unknown-arch
;;
esac
curl -Lfo /tini "${GH_PROXY:+$GH_PROXY/}https://github.com/krallin/tini/releases/latest/download/tini-static-$tini_type"
chmod +x /tini
EOF
# -------------------------------------------------------------------------------
FROM $BASE_IMAGE
SHELL [ "/bin/bash", "-c" ]
WORKDIR /app
ARG APT_PROXY
ARG TARGETPLATFORM
ARG GH_PROXY
COPY --from=base /workspace/nvim-linux64 /opt/nvim
COPY --from=base /tini /tini
RUN <<EOF
ln -s /opt/nvim/bin/nvim /usr/local/bin/nvim
mkdir -p /root/.config/nvim
if [[ -n "$APT_PROXY" ]]; then
sed -i "s|http://.*.ubuntu.com|$APT_PROXY|g" /etc/apt/sources.list
fi
apt update
apt install -y --no-install-recommends \
build-essential git curl ripgrep python3 python3-pip python3-pynvim
rm -rf /var/lib/apt/lists/*
EOF
COPY . /usr/local/share/nvim/site/pack/user/start/one.nvim
RUN <<EOF
if [ -n "$GH_PROXY" ]; then
git config --global http.https://gh.neting.cc.proxy $GH_PROXY
fi
echo "require('one').setup {}" > /root/.config/nvim/init.lua
EOF
LABEL maintainer="ADoyle <adoyle.h@gmail.com>"
LABEL description="Run nvim and one.nvim in container"
ENTRYPOINT ["/tini", "--", "nvim" ]
CMD [ "/app" ]