Newer
Older
ARG CODE_RELEASE
# environment settings
ENV HOME="/config"
RUN \
echo "**** install node repo ****" && \
apt-get update && \
apt-get install -y \
gnupg && \
curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - && \
echo 'deb https://deb.nodesource.com/node_14.x bionic main' \
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
> /etc/apt/sources.list.d/nodesource.list && \
curl -s https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
echo 'deb https://dl.yarnpkg.com/debian/ stable main' \
> /etc/apt/sources.list.d/yarn.list && \
echo "**** install build dependencies ****" && \
apt-get update && \
apt-get install -y \
build-essential \
libx11-dev \
libxkbfile-dev \
libsecret-1-dev \
pkg-config && \
echo "**** install runtime dependencies ****" && \
apt-get install -y \
git \
jq \
nano \
net-tools \
nodejs \
sudo \
yarn && \
echo "**** install code-server ****" && \
if [ -z ${CODE_RELEASE+x} ]; then \
CODE_RELEASE=$(curl -sX GET https://registry.yarnpkg.com/code-server \
| jq -r '."dist-tags".latest' | sed 's|^|v|'); \
fi && \
CODE_VERSION=$(echo "$CODE_RELEASE" | awk '{print substr($1,2); }') && \
yarn config set network-timeout 600000 -g && \
yarn --production --verbose --frozen-lockfile global add code-server@"$CODE_VERSION" && \
yarn cache clean && \
echo "**** clean up ****" && \
apt-get purge --auto-remove -y \
build-essential \
libx11-dev \
libxkbfile-dev \
libsecret-1-dev \
pkg-config && \
apt-get clean && \
rm -rf \
/tmp/* \
/var/lib/apt/lists/* \
/var/tmp/*
Dominique Marcadet
committed
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
# Install on-my-zsh
RUN chsh --shell /bin/zsh abc && \
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" && \
git clone --branch master --single-branch --depth 1 \
"https://github.com/zsh-users/zsh-autosuggestions.git" \
/config/.oh-my-zsh/plugins/zsh-autosuggestions && \
echo "source /config/.oh-my-zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh" \
>> /config/.zshrc && \
git clone --branch master --single-branch --depth 1 \
"https://github.com/zsh-users/zsh-syntax-highlighting.git" \
/config/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting && \
sed -i 's/plugins=(.*/plugins=(git vscode)/' /config/.zshrc && \
echo 'PS1="%B%F{blue}%~:%f%b "' >>/config/.zshrc
# The SSH key pair is stored in /config
RUN mkdir /root/.ssh && \
echo "Host gitlab-student.centralesupelec.fr " > /root/.ssh/config && \
echo " PreferredAuthentications publickey" >> /root/.ssh/config && \
echo " IdentityFile /config/.ssh/id_ed25519" >> /root/.ssh/config && \
mkdir /config/.ssh
# VSCode extension for Python
RUN /usr/local/bin/code-server --install-extension ms-python.python
# /config will be a docker volume, initially empty
# wrapper_script will do the copy from /init-config
RUN chown -R abc:abc /config && \
mv /config /init-config && \
mkdir -p /config/workspace && \
chown -R abc:abc /config
# Will be entry point
COPY wrapper_script.sh /usr/local/lib/wrapper_script.sh
# launch
ENTRYPOINT ["/bin/bash", "/usr/local/lib/wrapper_script.sh"]