-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile.simple
151 lines (139 loc) · 3.43 KB
/
Dockerfile.simple
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# Simple Dockerfile
# FROM alpine:latest
FROM frolvlad/alpine-glibc
MAINTAINER bbxytl <[email protected]>
# Modify the Repository
RUN cd /etc/apk/ \
&& mv repositories repositories.bk \
&& echo "http://mirrors.ustc.edu.cn/alpine/v3.5/main" > repositories \
&& echo "http://mirrors.ustc.edu.cn/alpine/v3.5/community" >> repositories
RUN apk add --no-cache --update \
# Install Virtual Soft
--virtual \
build-deps \
build-base \
ctags \
git \
libx11-dev \
libxpm-dev \
libxt-dev \
make \
ncurses-dev \
python \
python-dev \
bash \
# Build Vim
&& cd /tmp \
&& git clone https://github.com/vim/vim \
&& cd /tmp/vim \
&& ./configure \
--disable-gui \
--disable-netbeans \
--enable-multibyte \
--enable-pythoninterp \
--prefix=/usr \
--with-features=big \
--with-python-config-dir=/usr/lib/python2.7/config \
&& make install \
# Del Virtual Soft
&& apk del build-deps \
# Install Soft for Vim
&& apk add \
libice \
libsm \
libx11 \
libxt \
ncurses \
python \
bash \
# Cleanup
&& rm -rf \
/tmp/* \
/var/cache/* \
/var/log/* \
/var/tmp/* \
&& mkdir /var/cache/apk
# User config
ENV UID="1000" \
UNAME="developer" \
GID="1000" \
GNAME="developer" \
SHELL="/bin/bash" \
UHOME="/home/developer" \
UVIMHOME="/home/developer/.vim" \
UDOTFILES="/home/developer/mydotfiles/b-dotfiles"
# User
RUN apk add --no-cache --update sudo \
# Create HOME dir
&& mkdir -p "${UHOME}" \
&& chown "${UID}":"${GID}" "${UHOME}" \
# Create user
&& echo "${UNAME}:x:${UID}:${GID}:${UNAME},,,:${UHOME}:${SHELL}" \
>> /etc/passwd \
&& echo "${UNAME}::17032:0:99999:7:::" \
>> /etc/shadow \
# No password sudo
&& echo "${UNAME} ALL=(ALL) NOPASSWD: ALL" \
> "/etc/sudoers.d/${UNAME}" \
&& chmod 0440 "/etc/sudoers.d/${UNAME}" \
# Create group
&& echo "${GNAME}:x:${GID}:${UNAME}" \
>> /etc/group
# Install Need Soft
RUN apk add --no-cache --update \
curl \
git \
zsh \
# Cleanup
&& rm -rf \
/tmp/* \
/var/cache/* \
/var/log/* \
/var/tmp/* \
&& mkdir /var/cache/apk
USER $UNAME
# Shell And Vim Config
RUN cd $UHOME \
# Zsh Config. oh-my-zsh
&& sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" \
# Clone Dotfiles
&& mkdir -p $UHOME/mydotfiles \
&& cd $UHOME/mydotfiles \
&& git clone --depth 1 https://github.com/bbxytl/b-dotfiles \
# Shell and Other config
&& cd $UDOTFILES/b-shell \
&& sh install-shell-for-docker.sh \
&& cd $UDOTFILES/others \
&& sh install-others-for-docker.sh \
# Vim plugins deps
&& mkdir -p \
$UVIMHOME/bundle \
$UVIMHOME/vimbackup \
$UVIMHOME/vimswap \
$UVIMHOME/vimundo \
$UVIMHOME/runtime \
&& cd $UDOTFILES/b-vim/vim.config \
&& sh install-vim-for-docker.sh \
&& cd $UVIMHOME/bundle/ \
# Get All Need Clone from Github and Clone Then to bundle
&& grep "^Bundle [',\"]\S*/" ~/.vimrc.bundles| sed "s/Bundle [',\"]/https:\/\/github.com\//g" | sed "s/[',\"]//g" | while read line;do \
dirname=`echo ${line##*/} | sed 's/ //g'`; \
echo "git clone --depth 1 $line $UVIMHOME/bundle/$dirname"; \
git clone --depth 1 $line $UVIMHOME/bundle/$dirname; \
done \
# Clone Vundle Plugins
&& vim +BundleInstall +qall -c q \
# Config Second to replace modify
&& cd $UDOTFILES/b-vim/vim.config \
&& sh install-vim-for-docker.sh \
# Cleanup
&& sudo rm -rf \
/tmp/* \
/var/cache/* \
/var/log/* \
/var/tmp/* \
&& sudo mkdir /var/cache/apk
COPY docker-run /usr/local/bin/
USER $UNAME
ENV TERM=xterm-256color
ENTRYPOINT ["sh", "/usr/local/bin/docker-run"]