-
Notifications
You must be signed in to change notification settings - Fork 0
/
ubuntu_with_go
42 lines (36 loc) · 1.85 KB
/
ubuntu_with_go
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
FROM ubuntu
MAINTAINER xiaoyulei
RUN apt-get update && \
apt-get dist-upgrade -y && \
DEBIAN_FRONTEND=noninteractive TZ=Asia/Shanghai apt-get install -y sudo net-tools git wget silversearcher-ag openssh-server cmake build-essential gcc g++ autoconf automake git emacs vim sysstat libclang-dev clang pkg-config zlib1g-dev libssl-dev bear && \
apt-get autoremove && \
apt-get autoclean
RUN sed -i 's/^PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
RUN useradd -Groot,sudo -m -s /bin/bash xiaoyulei
RUN echo "root:Test_12#$" | chpasswd && echo "xiaoyulei:Test_12#$" | chpasswd
USER xiaoyulei
WORKDIR /home/xiaoyulei
RUN mkdir tools && \
cd tools && \
git clone https://github.com/YuleiXiao/emacsconfig.git && \
ln -s $PWD/emacsconfig $HOME/.emacs.d && \
wget https://dl.google.com/go/go1.10.linux-amd64.tar.gz && \
tar xf go1.10.linux-amd64.tar.gz && \
rm go1.10.linux-amd64.tar.gz && \
git clone https://github.com/nsf/gocode.git && \
git clone https://github.com/Andersbakken/rtags.git --recursive $HOME/tools/rtags && \
mkdir -p $HOME/tools/rtags/build && \
cd $HOME/tools/rtags/build && \
cmake .. && make && \
mkdir -p $HOME/.config/systemd/user && \
cp $HOME/tools/rtags/share/etc/services/system/* $HOME/.config/systemd/user/ && \
sed -i 's#$RDM#/home/xiaoyulei/tools/rtags/build/bin/rdm#g' $HOME/.config/systemd/user/rdm.service && \
systemctl --user enable rdm.socket
RUN echo "export GOROOT=$HOME/tools/go" > $HOME/tools/env.sh && \
echo "export PATH=$HOME/tools/gocode:$HOME/tools/go/bin:$HOME/tools/rtags/build/bin:$PATH" >> $HOME/tools/env.sh && \
echo "export TERM=xterm-256color" >> $HOME/tools/env.sh && \
echo "source $HOME/tools/env.sh" >> $HOME/.bashrc && \
. $HOME/tools/env.sh && \
cd $HOME/tools/gocode && go build
USER root
CMD ["/sbin/init"]