-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
73 lines (52 loc) · 2.08 KB
/
Dockerfile
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
# docker build .
FROM ubuntu:16.04
# Update System and Install Some Tools....
RUN dpkg-divert --local --rename --add /sbin/initctl
RUN ln -s /bin/true /sbin/initct
RUN apt-get update
RUN apt-get install -y apt-utils php7.0-mysql \
supervisor nginx php vim \
salt-minion openssh-server \
lsof dnsutils pciutils \
libterm-readline-perl-perl \
net-tools dialog git php-mysql \
iputils-ping sudo cron
COPY supervisord.conf /etc/supervisord.conf
COPY mysql-setup.sh /checkdbconf.sh
COPY mysql-script.sql /tmp/mysql-script.sql
COPY minion-cron /etc/cron.d/salt-standalone
COPY saltconf.tgz /tmp/saltconf.tgz
COPY masterless.conf /etc/salt/minion.d/masterless.conf
RUN chmod 777 /checkdbconf.sh
RUN mkdir /var/log/supervisord
# Install Mysql
RUN export DEBIAN_FRONTEND=noninteractive
RUN echo "mysql-server mysql-server/root_password password 'password'" | debconf-set-selections
RUN echo "mysql-server mysql-server/root_password_again password 'password'" | debconf-set-selections
RUN apt-get install mysql-server -y
## Set perms
RUN touch /var/log/mysql/error.log
RUN mkdir /var/run/mysqld
RUN chown -R mysql:mysql /var/log/mysql
RUN chown -R mysql:mysql /var/run/mysqld
# Configure SSH, we can also use docker exec to connect but this is fancy :D
RUN mkdir /var/run/sshd
RUN echo 'root:password' | chpasswd
RUN sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
# SSH login fix. Otherwise user is kicked off after login
RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
ENV NOTVISIBLE "in users profile"
RUN echo "export VISIBLE=now" >> /etc/profile
# Configure Nginx
COPY default /etc/nginx/sites-available/default
COPY index.php /var/www/html/index.php
# Configure Salt-Minion and run first highstate
RUN tar xvzf /tmp/saltconf.tgz -C /
RUN /usr/bin/salt-call state.highstate --local
# Cleaning The System
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
#### Final Steps ####
# Expose some ports
EXPOSE 22 8080
# Execute SupervisorD
CMD ["/usr/bin/supervisord"]