-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
168 lines (121 loc) · 4.64 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
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
167
168
FROM alpine:3.10
RUN apk update && apk upgrade
# Install the relevant packages
RUN apk add wget libzip-dev bison autoconf alpine-sdk pkgconf git \
libltdl libbz2 libxml2-dev libssl1.1 libmcrypt-dev libressl-dev curl-dev
# Install pear for installing pthreads later.
RUN apk add php-pear
# The previous command will have installed PHP, so remove it
RUN apk del php-cli
WORKDIR /root
RUN wget https://github.com/php/php-src/archive/php-7.2.34.tar.gz
RUN tar --extract --gzip --file php-*
RUN rm php-*.tar.gz
RUN mv php-src-* php-src
WORKDIR /root/php-src
RUN ./buildconf --force
ENV CONFIGURE_STRING="--prefix=/etc/php7 \
--disable-cgi \
--disable-pdo \
--enable-sockets \
--enable-pcntl \
--enable-json \
--enable-simplexml \
--enable-cli \
--enable-maintainer-zts \
--enable-xml \
--with-openssl \
--with-pcre-regex \
--with-config-file-path=/etc/php7/cli \
--with-config-file-scan-dir=/etc/php7/etc \
--with-curl \
--with-tsrm-pthreads \
--without-sqlite3"
RUN ./configure $CONFIGURE_STRING
RUN make && make install
# Update the symlink for php to point to our custom build.
RUN rm /usr/bin/php
# Install pthreads
RUN chmod o+x /etc/php7/bin/phpize
RUN chmod o+x /etc/php7/bin/php-config
RUN git clone --depth 1 https://github.com/krakjoe/pthreads.git
WORKDIR /root/php-src/pthreads
RUN /etc/php7/bin/phpize
RUN ./configure \
--prefix='/etc/php7' \
--with-libdir='/lib/x86_64-linux-gnu' \
--enable-pthreads=shared \
--with-php-config='/etc/php7/bin/php-config'
RUN make && make install
# Set up our php ini
RUN mkdir -p /etc/php7/cli/
RUN cp ~/php-src/php.ini-production /etc/php7/cli/php.ini
# Add the pthreads extension to the php.ini
RUN echo "extension=pthreads.so" | tee -a /etc/php7/cli/php.ini
RUN echo "zend_extension=opcache.so" | tee -a /etc/php7/cli/php.ini
RUN ln -s /etc/php7/bin/php /usr/bin/php
WORKDIR /tmp
RUN apk add --no-cache --repository http://dl-3.alpinelinux.org/alpine/edge/testing gnu-libiconv
ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so
RUN apk add jq
RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
RUN php -r "if (hash_file('sha384', 'composer-setup.php') === '906a84df04cea2aa72f40b5f787e49f22d4c2f19492ac310e8cba5b96ac8b64115ac402c8cd292b8a03482574915d1a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
RUN php composer-setup.php --filename=composer
RUN php -r "unlink('composer-setup.php');"
RUN for branchName in $(curl https://api.github.com/repos/zeko868/schedule-generator/branches | jq -r '.[].name' | grep -v '^assets$'); \
do \
git clone --branch "$branchName" --depth 1 https://github.com/zeko868/schedule-generator.git /var/www/localhost/htdocs/$branchName; \
cd /var/www/localhost/htdocs/$branchName; \
rm -rf .git; \
if [ -e composer.json ]; \
then \
/tmp/composer install; \
fi \
done;
RUN apk del jq
RUN git clone --depth 1 https://github.com/SWI-Prolog/swipl-devel.git
RUN apk add --no-cache \
build-base \
zlib-dev \
cmake \
&& mkdir swipl-devel/build
WORKDIR /tmp/swipl-devel/build
RUN cmake \
-DCMAKE_BUILD_TYPE=MinSizeRel \
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DSWIPL_PACKAGES_ODBC=OFF \
-DSWIPL_PACKAGES_JAVA=OFF \
-DSWIPL_PACKAGES_X=OFF \
-DBUILD_TESTING=OFF \
-DINSTALL_DOCUMENTATION=OFF \
..
RUN make -j$(nproc)
RUN make install
WORKDIR /
RUN \
apk add --no-cache \
apache2-proxy \
apache2-ssl \
apache2-utils \
php7-apache2 \
php7-curl \
php7-json \
php7-xmlreader \
php7-session \
logrotate \
openssl
RUN rm /var/www/localhost/htdocs/index.html
RUN for repoName in $(ls -1 /var/www/localhost/htdocs/); do ln -s /var/www/localhost/htdocs/current/shared-data /var/www/localhost/htdocs/$repoName/shared-data; done
RUN sed 's/AllowOverride None/AllowOverride All/g' -i /etc/apache2/httpd.conf
RUN git clone https://github.com/ramlmn/Apache-Directory-Listing.git /tmp/apache-directory-listing
RUN cp -r /tmp/apache-directory-listing/directory-listing /var/www/localhost/htdocs/
RUN sed 's#{LISTING_DIRECTORY}#directory-listing#g' /tmp/apache-directory-listing/htaccess.txt | sed 's#{LISTING_STYLE}#grid#g' > /var/www/localhost/htdocs/.htaccess
RUN apk del php-pear build-base cmake wget libzip-dev bison autoconf alpine-sdk pkgconf git su-exec cmake readline-dev tar libc-utils scanelf musl-utils
RUN rm -rf /tmp/* /root/php-src
RUN sed -i 's#^ErrorLog.*#ErrorLog /dev/stderr#g' /etc/apache2/httpd.conf
RUN ln -s /etc/php7/bin/php /usr/bin/php
ENV USE_ZEND_ALLOC 0
EXPOSE 80 28960
VOLUME [ "/var/www/localhost/htdocs/current" ]
CMD ["/usr/sbin/httpd", "-D", "FOREGROUND"]