-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathDockerfile.alpine
55 lines (43 loc) · 1.97 KB
/
Dockerfile.alpine
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
FROM alpine:3.5 as build
RUN apk add --no-cache build-base ncurses-dev zlib-dev wget flex perl imap-dev
WORKDIR /tmp
# Build Apache 2.2
ADD httpd-2.2.34.tar.bz2 .
RUN cd httpd-2.2.34 \
&&./configure --prefix=/usr/local/apache2 --enable-mods-shared=all --enable-deflate --enable-proxy --enable-proxy-balancer --enable-proxy-http --with-imap \
&& make \
&& make install
# Build PHP 4
ADD php-4.4.9.tar.bz2 .
ADD php.ini /usr/local/apache2/php.ini
RUN cd php-4.4.9 \
&& ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --enable-force-cgi-redirect --disable-cgi --with-zlib \
--with-config-file-path=/usr/local/apache2 \
&& make && make install
# Setup PHP to Run on Apache
RUN echo 'AddType application/x-httpd-php php' >> /usr/local/apache2/conf/httpd.conf \
&& sed -i 's/DirectoryIndex index.html/DirectoryIndex index.php index.html/' /usr/local/apache2/conf/httpd.conf
# Build Mysql 4
ADD mysql-4.1.22.tar.bz2 .
RUN echo '/* Linuxthreads */' >> /usr/include/pthread.h \
&& cd mysql-4.1.22 \
&& ./configure --prefix=/usr/local/mysql CXXFLAGS="-std=gnu++98" \
&& make && make install
# Linuxtrheads hack explained: https://bugs.mysql.com/bug.php?id=19785
# gnu++98 (error: narrowing conversion): https://bugs.mysql.com/bug.php?id=19785
FROM alpine:3.5
RUN apk add --no-cache libstdc++ imap-dev tzdata
# Setup Mysql to Run
ADD my.cnf /usr/local/mysql/my.cnf
RUN addgroup -S mysql && adduser -S mysql -G mysql \
&& mkdir /usr/local/mysql/var \
&& chown -R root /usr/local/mysql && chown -R mysql /usr/local/mysql/var && chgrp -R mysql /usr/local/mysql
COPY --from=build /usr/local/apache2 /usr/local/apache2
COPY --from=build /usr/local/mysql /usr/local/mysql
ENV PATH="${PATH}:/usr/local/apache2/bin/:/usr/local/mysql/bin/"
VOLUME /usr/local/mysql/var /usr/local/apache2/htdocs/
EXPOSE 80
CMD apachectl start \
&& chown daemon -R /usr/local/apache2/htdocs/ \
&& chown mysql -R /usr/local/mysql/var/ \
&& mysqld_safe --defaults-file=/usr/local/mysql/my.cnf