-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.centos
105 lines (89 loc) · 3.69 KB
/
Dockerfile.centos
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
FROM centos
ENV OS linux
ENV ARCH amd64
ENV USER docker
# RUN printf "errorlevel=0\nrpmverbosity=critical\n" >> /etc/yum.conf
# yum groupinstall --assumeyes --quiet "Development Tools" && \
# yum install --assumeyes --quiet \
# gettext-devel openssl-devel perl-CPAN perl-devel zlib-devel \
# ca-certificates \
# Git requires:
# curl-devel expat-devel gettext-devel openssl-devel zlib-devel
# gcc perl-ExtUtils-MakeMaker
# Tmux requires:
# # libevent file
# kernel-devel ncurses-devel
# autotools
# autoconf make
RUN yum update --assumeyes --quiet && \
yum install --assumeyes --quiet \
curl-devel expat-devel gettext-devel openssl-devel zlib-devel \
gcc perl-ExtUtils-MakeMaker \
kernel-devel ncurses-devel file \
autoconf make \
epel-release \
sudo
# Install latest git version instead of 1.8
ENV GIT_VERSION 2.18.0
# ADD https://github.com/git/git/archive/v$GIT_VERSION.tar.gz git.tar.gz
RUN curl -sSL https://github.com/git/git/archive/v$GIT_VERSION.tar.gz \
-o git.tar.gz && \
tar -zxf git.tar.gz && rm $_ && \
cd git-$GIT_VERSION && \
make --quiet configure && \
./configure --prefix=/usr/local --quiet && \
sudo make --quiet install
# Install libevent
ENV LIBEVENT_VERSION 2.1.8
RUN curl -sSL https://github.com/libevent/libevent/releases/download/release-$LIBEVENT_VERSION-stable/libevent-$LIBEVENT_VERSION-stable.tar.gz \
-o libevent.tar.gz && \
tar -xzf libevent.tar.gz && rm $_ && \
cd libevent-$LIBEVENT_VERSION-stable && \
./configure --prefix=/usr/local --quiet && \
make --quiet && \
sudo make --quiet install
# Install latest tmux version instead of 1.8
ENV TMUX_VERSION 2.7
# RUN git clone https://github.com/tmux/tmux.git && \
RUN curl -sSL https://github.com/tmux/tmux/releases/download/$TMUX_VERSION/tmux-$TMUX_VERSION.tar.gz \
-o tmux.tar.gz && \
tar -zxf tmux.tar.gz && rm $_ && \
cd tmux-$TMUX_VERSION && \
LDFLAGS="-L/usr/local/lib -Wl,-rpath=/usr/local/lib" ./configure --prefix=/usr/local --quiet && \
make --quiet && \
sudo make --quiet install
# Install latest ruby instead of 2.0 (neovim ruby host requires >= 2.2.0)
ENV RUBY_VERSION 2.5.1
RUN curl -sSL https://cache.ruby-lang.org/pub/ruby/2.5/ruby-$RUBY_VERSION.tar.gz \
-o ruby.tar.gz && \
tar -zxf ruby.tar.gz && rm $_ && \
cd ruby-$RUBY_VERSION && \
./configure --prefix=/usr/local --quiet && \
make --quiet && \
sudo make --quiet install
COPY ./dist/${OS}_${ARCH}/dot /usr/local/bin/dot
# COPY ./scripts/setup-lang.sh setup-lang.sh
COPY ./scripts/setup-user.sh setup-user.sh
# RUN ./setup-lang.sh
# ENV LANG en_GB.UTF-8
# ENV LANGUAGE en_GB:en
# ENV LC_ALL en_GB.UTF-8
RUN groupadd sudo
RUN ./setup-user.sh --groups sudo --password '' $USER
# Add /usr/local/bin to sudo PATH
#sed -e 's#Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin#Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin#' /etc/sudoers
#sed -e 's#Defaults[[:blank:]]+secure_path = /sbin:/bin:/usr/sbin:/usr/bin#Defaults[[:blank:]]+secure_path = /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin#' /etc/sudoers
# Deb: Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
# sed -e '/secure_path/ s[=.*[&:/usr/local/bin[' /etc/sudoers
# sed -r -e '/^\s*Defaults\s+secure_path/ s[=(.*)[=\1:/usr/local/bin[' /etc/sudoers
# RUN echo 'Defaults secure_path="<default value>:/usr/local/bin"' >> "/etc/sudoers.d/$USER"
RUN sed -i -e 's#Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin#Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin#' /etc/sudoers
#RUN ./setup-pacapt.sh
USER $USER
WORKDIR /home/$USER
RUN mkdir $HOME/bin
RUN echo 'PATH=$PATH:$HOME/bin' >> ~/.profile
# ENV PATH $PATH:$HOME/bin
RUN curl -sSL https://git.io/dotfiles.config -o .dotrc.yml
COPY --chown=docker:docker ./scripts bin/
ENTRYPOINT ["/bin/bash"]