-
Notifications
You must be signed in to change notification settings - Fork 44
/
Dockerfile.fpm
80 lines (71 loc) · 2.67 KB
/
Dockerfile.fpm
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
# First stage, install composer and its dependencies and fetch vendor files
FROM alpine:3.7
RUN apk --no-cache add \
php5 \
php5-dom \
php5-phar \
php5-gd \
php5-iconv \
php5-json \
php5-mysql \
php5-openssl \
php5-xml \
php5-zlib \
php5-curl \
curl
RUN mkdir /app && mkdir /app/pleio && curl -sS https://getcomposer.org/installer | php5 -- --install-dir=/usr/local/bin --filename=composer
RUN ln -s /usr/bin/php5 /usr/bin/php
WORKDIR /app
COPY composer.json composer.json /app/
COPY mod/pleio/composer.json /app/pleio/
ARG COMPOSER_ALLOW_SUPERUSER=1
ARG COMPOSER_NO_INTERACTION=1
RUN composer install
WORKDIR /app/pleio
RUN composer install
# Second stage, build usable container
FROM php:5.6-fpm-alpine3.7
LABEL maintainer="Ilia Salem"
RUN \
apk update \
&& apk --no-cache add \
apache2 \
libpng \
libmemcached-dev zlib-dev autoconf gcc libc-dev make \
# memcached php5 extension
&& pecl install memcached-2.2.0 \
&& docker-php-ext-enable memcached \
&& mkdir -p /var/www/html/vendor \
&& mkdir -p /data \
&& mkdir -p /run/apache2 \
&& chown apache /data \
&& ln -s /dev/stderr /var/log/apache2/error.log \
&& ln -s /dev/stdout /var/log/apache2/access.log \
&& sed -i '/#LoadModule rewrite_module modules\/mod_rewrite.so/c\LoadModule rewrite_module modules\/mod_rewrite.so' /etc/apache2/httpd.conf \
&& sed -i '/DocumentRoot "\/var\/www\/localhost\/htdocs"/c\DocumentRoot "\/var\/www\/html"' /etc/apache2/httpd.conf \
&& sed -i '/Options Indexes FollowSymLinks/c\\' /etc/apache2/httpd.conf \
&& sed -i '/AllowOverride None/c\\' /etc/apache2/httpd.conf \
&& sed -i '/Options Indexes FollowSymLinks/c\\' /etc/apache2/httpd.conf \
&& sed -i '/<Directory "\/var\/www\/localhost\/htdocs">/c\<Directory "\/var\/www\/html">\nDirectoryIndex index.php\nOptions FollowSymLinks MultiViews\nAllowOverride All\nOrder allow,deny\nallow from all\n' /etc/apache2/httpd.conf
RUN { \
echo 'opcache.memory_consumption=128'; \
echo 'opcache.interned_strings_buffer=8'; \
echo 'opcache.max_accelerated_files=4000'; \
echo 'opcache.revalidate_freq=60'; \
echo 'opcache.fast_shutdown=1'; \
echo 'opcache.enable_cli=1'; \
echo 'opcache.enable_file_override=1'; \
} > /usr/local/etc/php/conf.d/opcache-recommended.ini
COPY ./install/config/htaccess.dist /var/www/html/.htaccess
COPY --from=0 /app/vendor/ /var/www/html/vendor/
COPY . /var/www/html
COPY --from=0 /app/pleio/vendor/ /var/www/html/mod/pleio/vendor/
RUN chown apache:apache /var/www/html
WORKDIR /var/www/html
EXPOSE 80
EXPOSE 443
RUN chmod +x docker/start.sh
# Start Apache in foreground mode
RUN rm -f /run/apache2/httpd.pid
ENTRYPOINT [ "docker/start.sh" ]
CMD ["/usr/sbin/httpd -D FOREGROUND"]