|
1 |
| -FROM nginx:1.17.8-alpine |
| 1 | +FROM php:7.1-fpm-alpine |
2 | 2 |
|
3 |
| -EXPOSE 8000 |
4 |
| -CMD ["/sbin/entrypoint.sh"] |
5 |
| - |
6 |
| -ARG cachet_ver |
7 |
| -ARG archive_url |
8 |
| - |
9 |
| -ENV cachet_ver ${cachet_ver:-2.4} |
10 |
| -ENV archive_url ${archive_url:-https://github.com/cachethq/Cachet/archive/${cachet_ver}.tar.gz} |
11 |
| - |
12 |
| -ENV COMPOSER_VERSION 1.9.0 |
| 3 | +LABEL maintainer= "Alt Three <[email protected]>" |
13 | 4 |
|
14 |
| -RUN apk add --no-cache --update \ |
15 |
| - postgresql-client \ |
16 |
| - postgresql \ |
17 |
| - mysql-client \ |
18 |
| - php7 \ |
19 |
| - php7-redis \ |
20 |
| - php7-apcu \ |
21 |
| - php7-bcmath \ |
22 |
| - php7-dom \ |
23 |
| - php7-ctype \ |
24 |
| - php7-curl \ |
25 |
| - php7-fpm \ |
26 |
| - php7-fileinfo \ |
27 |
| - php7-gd \ |
28 |
| - php7-iconv \ |
29 |
| - php7-intl \ |
30 |
| - php7-json \ |
31 |
| - sqlite \ |
32 |
| - php7-mbstring \ |
33 |
| - php7-mcrypt \ |
34 |
| - php7-mysqlnd \ |
35 |
| - php7-opcache \ |
36 |
| - php7-openssl \ |
37 |
| - php7-pdo \ |
38 |
| - php7-pdo_mysql \ |
39 |
| - php7-pdo_pgsql \ |
40 |
| - php7-pdo_sqlite \ |
41 |
| - php7-phar \ |
42 |
| - php7-posix \ |
43 |
| - php7-session \ |
44 |
| - php7-sqlite3 \ |
45 |
| - php7-simplexml \ |
46 |
| - php7-soap \ |
47 |
| - php7-xml \ |
48 |
| - php7-xmlwriter \ |
49 |
| - php7-zip \ |
50 |
| - php7-zlib \ |
51 |
| - php7-tokenizer \ |
52 |
| - wget sqlite git curl bash grep \ |
53 |
| - supervisor |
| 5 | +# entrypoint.sh dependencies |
| 6 | +RUN apk add --no-cache \ |
| 7 | + bash \ |
| 8 | + nginx \ |
| 9 | + postgresql-client \ |
| 10 | + supervisor |
54 | 11 |
|
55 |
| -# forward request and error logs to docker log collector |
56 |
| -RUN ln -sf /dev/stdout /var/log/nginx/access.log && \ |
57 |
| - ln -sf /dev/stderr /var/log/nginx/error.log && \ |
58 |
| - ln -sf /dev/stdout /var/log/php7/error.log && \ |
59 |
| - ln -sf /dev/stderr /var/log/php7/error.log |
| 12 | +# Install PHP extensions |
| 13 | +RUN set -eux; \ |
| 14 | + \ |
| 15 | + apk add --no-cache --virtual .build-deps \ |
| 16 | + $PHPIZE_DEPS \ |
| 17 | + libjpeg-turbo-dev \ |
| 18 | + libmcrypt-dev \ |
| 19 | + libmemcached-dev \ |
| 20 | + libpng-dev \ |
| 21 | + openldap-dev \ |
| 22 | + pcre-dev \ |
| 23 | + postgresql-dev \ |
| 24 | + sqlite-dev \ |
| 25 | + ; \ |
| 26 | + \ |
| 27 | + docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr; \ |
| 28 | + docker-php-ext-install \ |
| 29 | + gd \ |
| 30 | + mysqli \ |
| 31 | + opcache \ |
| 32 | + pdo_mysql \ |
| 33 | + pdo_pgsql \ |
| 34 | + pdo_sqlite \ |
| 35 | + pgsql \ |
| 36 | + zip \ |
| 37 | + ; \ |
| 38 | + \ |
| 39 | +# pecl will claim success even if one install fails, so we need to perform each install separately |
| 40 | + pecl install APCu-5.1.17; \ |
| 41 | + pecl install redis-4.3.0; \ |
| 42 | + \ |
| 43 | + docker-php-ext-enable \ |
| 44 | + apcu \ |
| 45 | + redis \ |
| 46 | + ; \ |
| 47 | + \ |
| 48 | + runDeps="$( \ |
| 49 | + scanelf --needed --nobanner --format '%n#p' --recursive /usr/local/lib/php/extensions \ |
| 50 | + | tr ',' '\n' \ |
| 51 | + | sort -u \ |
| 52 | + | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ |
| 53 | + )"; \ |
| 54 | + apk add --virtual .postfixadmin-phpexts-rundeps $runDeps; \ |
| 55 | + apk del .build-deps |
60 | 56 |
|
61 |
| -RUN adduser -S -s /bin/bash -u 1001 -G root www-data |
| 57 | +# set recommended PHP.ini settings |
| 58 | +# see https://secure.php.net/manual/en/opcache.installation.php |
| 59 | +RUN { \ |
| 60 | + echo 'opcache.memory_consumption=128'; \ |
| 61 | + echo 'opcache.interned_strings_buffer=8'; \ |
| 62 | + echo 'opcache.max_accelerated_files=4000'; \ |
| 63 | + echo 'opcache.revalidate_freq=2'; \ |
| 64 | + echo 'opcache.fast_shutdown=1'; \ |
| 65 | + } > /usr/local/etc/php/conf.d/opcache-recommended.ini |
62 | 66 |
|
63 |
| -RUN touch /var/run/nginx.pid && \ |
64 |
| - chown -R www-data:root /var/run/nginx.pid /etc/php7/php-fpm.d |
65 |
| - |
66 |
| -RUN mkdir -p /var/www/html && \ |
67 |
| - mkdir -p /usr/share/nginx/cache && \ |
68 |
| - mkdir -p /var/cache/nginx && \ |
69 |
| - mkdir -p /var/lib/nginx && \ |
70 |
| - chown -R www-data:root /var/www /usr/share/nginx/cache /var/cache/nginx /var/lib/nginx/ |
| 67 | +#VOLUME /var/www/html |
| 68 | +ENV COMPOSER_VERSION 1.9.0 |
71 | 69 |
|
72 | 70 | # Install composer
|
73 |
| -RUN wget https://getcomposer.org/installer -O /tmp/composer-setup.php && \ |
74 |
| - wget https://composer.github.io/installer.sig -O /tmp/composer-setup.sig && \ |
75 |
| - php -r "if (hash('SHA384', file_get_contents('/tmp/composer-setup.php')) !== trim(file_get_contents('/tmp/composer-setup.sig'))) { unlink('/tmp/composer-setup.php'); echo 'Invalid installer' . PHP_EOL; exit(1); }" && \ |
76 |
| - php /tmp/composer-setup.php --version=$COMPOSER_VERSION --install-dir=bin && \ |
77 |
| - php -r "unlink('/tmp/composer-setup.php');" |
| 71 | +RUN set -eux; \ |
| 72 | + curl -fsSL https://getcomposer.org/installer -o /tmp/composer-setup.php; \ |
| 73 | + curl -fsSL https://composer.github.io/installer.sig -o /tmp/composer-setup.sig; \ |
| 74 | + php -r "if (hash('SHA384', file_get_contents('/tmp/composer-setup.php')) !== trim(file_get_contents('/tmp/composer-setup.sig'))) { unlink('/tmp/composer-setup.php'); echo 'Invalid installer' . PHP_EOL; exit(1); }"; \ |
| 75 | + php /tmp/composer-setup.php --version=$COMPOSER_VERSION --install-dir=/bin; \ |
| 76 | + php -r "unlink('/tmp/composer-setup.php');" |
78 | 77 |
|
79 |
| -WORKDIR /var/www/html/ |
80 |
| -USER 1001 |
| 78 | +ARG cachet_ver=2.3.18 |
| 79 | +ARG archive_url=https://github.com/CachetHQ/Cachet/archive/v${cachet_ver}.tar.gz |
81 | 80 |
|
82 |
| -RUN wget ${archive_url} && \ |
83 |
| - tar xzf ${cachet_ver}.tar.gz --strip-components=1 && \ |
84 |
| - chown -R www-data:root /var/www/html && \ |
85 |
| - rm -r ${cachet_ver}.tar.gz && \ |
86 |
| - php /bin/composer.phar global require "hirak/prestissimo:^0.3" && \ |
87 |
| - php /bin/composer.phar install -o && \ |
88 |
| - rm -rf bootstrap/cache/* |
| 81 | +ENV cachet_ver ${cachet_ver} |
| 82 | +ENV archive_url ${archive_url} |
| 83 | + |
| 84 | +RUN set -eux; \ |
| 85 | + curl -o cachet.tar.gz -fSL "${archive_url}"; \ |
| 86 | + # upstream tarball include ./Cachet-${cachet_ver}/ |
| 87 | + tar -xf cachet.tar.gz -C /var/www/html --strip-components=1; \ |
| 88 | + rm cachet.tar.gz; \ |
| 89 | + composer.phar global require "hirak/prestissimo:^0.3"; \ |
| 90 | + composer.phar install -q -o; \ |
| 91 | + rm -rf bootstrap/cache/* ~/.composer /bin/composer.phar; \ |
| 92 | + chown -R www-data:www-data /var/www/html |
89 | 93 |
|
90 | 94 | COPY conf/php-fpm-pool.conf /etc/php7/php-fpm.d/www.conf
|
91 | 95 | COPY conf/supervisord.conf /etc/supervisor/supervisord.conf
|
92 | 96 | COPY conf/nginx.conf /etc/nginx/nginx.conf
|
93 | 97 | COPY conf/nginx-site.conf /etc/nginx/conf.d/default.conf
|
94 | 98 | COPY conf/.env.docker /var/www/html/.env
|
95 |
| -COPY entrypoint.sh /sbin/entrypoint.sh |
| 99 | +COPY entrypoint.sh /usr/local/bin/ |
96 | 100 |
|
97 |
| -USER root |
98 |
| -RUN chmod g+rwx /var/run/nginx.pid && \ |
99 |
| - chmod -R g+rw /var/www /usr/share/nginx/cache /var/cache/nginx /var/lib/nginx/ /etc/php7/php-fpm.d storage |
100 |
| -USER 1001 |
| 101 | +EXPOSE 8000 |
| 102 | +CMD ["entrypoint.sh"] |
0 commit comments