forked from starwarsfan/edomi-baseimage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathamd64.Dockerfile
166 lines (149 loc) · 4.99 KB
/
amd64.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
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
FROM starwarsfan/edomi-baseimage-builder:amd64-latest as builder
MAINTAINER Yves Schumann <y.schumann@yetnet.ch>
# Dependencies to build stuff
RUN yum -y install \
mosquitto \
mosquitto-devel \
mysql-devel \
php-devel \
which
# For 19001051 (MQTT Publish Server)
RUN cd /tmp \
&& git clone https://github.com/mgdm/Mosquitto-PHP \
&& cd Mosquitto-PHP \
&& phpize \
&& ./configure \
&& make \
&& make install DESTDIR=/tmp/Mosquitto-PHP
RUN cd /tmp \
&& mkdir -p /tmp/Mosquitto-PHP/usr/lib64/mysql/plugin \
&& git clone https://github.com/jonofe/lib_mysqludf_sys \
&& cd lib_mysqludf_sys/ \
&& gcc -DMYSQL_DYNAMIC_PLUGIN -fPIC -Wall -I/usr/include/mysql -I. -shared lib_mysqludf_sys.c -o /tmp/Mosquitto-PHP/usr/lib64/mysql/plugin/lib_mysqludf_sys.so
RUN cd /tmp \
&& git clone https://github.com/mysqludf/lib_mysqludf_log \
&& cd lib_mysqludf_log \
&& autoreconf -i \
&& ./configure \
&& make \
&& make install DESTDIR=/tmp/Mosquitto-PHP
FROM centos:7
MAINTAINER Yves Schumann <y.schumann@yetnet.ch>
RUN yum update -y \
&& yum upgrade -y \
&& yum install -y \
epel-release \
&& yum update -y \
&& yum install -y \
ca-certificates \
dos2unix \
expect \
file \
git \
hostname \
httpd \
mariadb-server \
mod_ssl \
mosquitto \
mosquitto-devel \
nano \
net-snmp-utils \
net-tools \
nss \
ntp \
oathtool \
openssh-server \
openssl \
tar \
unzip \
vsftpd \
wget \
yum-utils \
&& yum install -y \
http://rpms.remirepo.net/enterprise/remi-release-7.rpm \
&& yum-config-manager \
--enable remi-php74 \
&& yum install -y \
php \
php-curl \
php-gd \
php-json \
php-mbstring \
php-mysql \
php-process \
php-snmp \
php-soap \
php-ssh2 \
php-xml \
php-zip \
&& yum clean all \
&& rm -f /etc/vsftpd/ftpusers \
/etc/vsftpd/user_list
# Alexa
RUN ln -s /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem /etc/pki/tls/cacert.pem \
&& sed -i \
-e '/\[curl\]/ a curl.cainfo = /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem' \
-e '/\[openssl\] a openssl.cafile = /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem' \
/etc/php.ini
# Mosquitto-LBS
COPY --from=builder /tmp/Mosquitto-PHP/modules /usr/lib64/php/modules/
COPY --from=builder /tmp/Mosquitto-PHP/usr/lib64/mysql /usr/lib64/mysql/
COPY --from=builder /tmp/lib_mysqludf_log/installdb.sql /root/
RUN echo 'extension=mosquitto.so' > /etc/php.d/50-mosquitto.ini
# Get composer
RUN cd /tmp \
&& php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \
&& php -r "if (hash_file('sha384', 'composer-setup.php') === file_get_contents('https://composer.github.io/installer.sig')) { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" \
&& php composer-setup.php \
&& php -r "unlink('composer-setup.php');" \
&& mv composer.phar /usr/local/bin/composer \
&& mkdir -p /usr/local/edomi/main/include/php
# Telegram-LBS 19000303 / 19000304
RUN cd /usr/local/edomi/main/include/php \
&& git clone https://github.com/php-telegram-bot/core \
&& mv core php-telegram-bot \
&& cd php-telegram-bot \
&& composer install \
&& chmod 777 -R .
# MikroTik RouterOS API 19001059
#RUN cd /usr/local/edomi/main/include/php \
# && git clone https://github.com/jonofe/Net_RouterOS \
# && cd Net_RouterOS \
# && composer install \
# && chmod 777 -R .
# Philips HUE Bridge 19000195
# As long as https://github.com/sqmk/Phue/pull/143 is not merged, fix phpunit via sed
RUN cd /usr/local/edomi/main/include/php \
&& git clone https://github.com/sqmk/Phue \
&& cd Phue \
&& sed -i "s/PHPUnit/phpunit/g" composer.json \
&& composer install \
&& chmod 777 -R .
# Mailer-LBS 19000587
RUN cd /usr/local/edomi/main/include/php \
&& mkdir PHPMailer \
&& cd PHPMailer \
&& composer require phpmailer/phpmailer \
&& chmod 777 -R .
# Alexa Control 19000809
RUN cd /etc/ssl/certs \
&& wget https://curl.haxx.se/ca/cacert.pem -O /etc/ssl/certs/cacert-Mozilla.pem \
&& echo "curl.cainfo=/etc/ssl/certs/cacert-Mozilla.pem" >> /etc/php.d/curl.ini
# Edomi
RUN systemctl enable ntpd \
&& systemctl enable vsftpd \
&& systemctl enable httpd \
&& systemctl enable mariadb
RUN sed -e "s/listen=.*$/listen=YES/g" \
-e "s/listen_ipv6=.*$/listen_ipv6=NO/g" \
-e "s/userlist_enable=.*/userlist_enable=NO/g" \
-i /etc/vsftpd/vsftpd.conf \
&& mv /usr/bin/systemctl /usr/bin/systemctl_ \
&& wget https://raw.githubusercontent.com/starwarsfan/docker-systemctl-replacement/master/files/docker/systemctl.py -O /usr/bin/systemctl \
&& chmod 755 /usr/bin/systemctl
# Remove limitation to only one installed language
RUN sed -i "s/override_install_langs=.*$/override_install_langs=all/g" /etc/yum.conf \
&& yum update -y \
&& yum reinstall -y \
glibc-common \
&& yum clean all