From dba458cad96c2d0480289e4767f962c801605ec9 Mon Sep 17 00:00:00 2001 From: El RIDO Date: Mon, 24 Jun 2019 21:19:09 +0200 Subject: [PATCH] with alpine 3.10 we have version parity with the php image, so a smaller image with minimal dependencies is possible --- Dockerfile | 28 ++------- etc/php7/conf.d/00-docker.ini | 60 +++++++++++++++++++ etc/php7/php-fpm.d/zz-docker.conf | 13 ++++ etc/supervisor.d/docker.ini | 4 +- usr/local/etc/php-fpm.d/50-clear-env.conf | 2 - usr/local/etc/php-fpm.d/50-no-access-log.conf | 2 - usr/local/etc/php-fpm.d/50-socket.conf | 5 -- .../etc/php/conf.d/00-best-practices.ini | 8 --- usr/local/etc/php/conf.d/00-performance.ini | 26 -------- usr/local/etc/php/conf.d/00-security.ini | 16 ----- 10 files changed, 81 insertions(+), 83 deletions(-) create mode 100644 etc/php7/conf.d/00-docker.ini create mode 100644 etc/php7/php-fpm.d/zz-docker.conf delete mode 100644 usr/local/etc/php-fpm.d/50-clear-env.conf delete mode 100644 usr/local/etc/php-fpm.d/50-no-access-log.conf delete mode 100644 usr/local/etc/php-fpm.d/50-socket.conf delete mode 100644 usr/local/etc/php/conf.d/00-best-practices.ini delete mode 100644 usr/local/etc/php/conf.d/00-performance.ini delete mode 100644 usr/local/etc/php/conf.d/00-security.ini diff --git a/Dockerfile b/Dockerfile index 634ff22..93b82ba 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM php:7.3.6-fpm-alpine3.9 +FROM alpine:3.10.0 MAINTAINER PrivateBin @@ -6,18 +6,8 @@ ENV RELEASE 1.2.1 RUN \ # Install dependencies - apk add --no-cache nginx supervisor \ -# Install PHP extension: opcache - && docker-php-ext-install -j$(nproc) opcache \ - && rm -f /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini \ -# Install PHP extension: gd - && apk add --no-cache freetype libpng libjpeg-turbo freetype-dev libpng-dev libjpeg-turbo-dev \ - && docker-php-ext-configure gd \ - --with-freetype-dir=/usr/include/ \ - --with-png-dir=/usr/include/ \ - --with-jpeg-dir=/usr/include/ \ - && docker-php-ext-install -j$(nproc) gd \ - && apk del --no-cache freetype-dev libpng-dev libjpeg-turbo-dev \ + apk add --no-cache supervisor nginx php7-fpm php7-json php7-gd php7-opcache \ + php7-pdo_mysql php7-pdo_pgsql \ # Remove (some of the) default nginx config && rm -f /etc/nginx.conf \ && rm -f /etc/nginx/conf.d/default.conf \ @@ -30,13 +20,8 @@ RUN \ # Create folder where the user hook into our default configs && mkdir -p /etc/nginx/server.d/ \ && mkdir -p /etc/nginx/location.d/ \ -# Bring php-fpm configs into a more controallable state - && rm /usr/local/etc/php-fpm.d/www.conf.default \ - && mv /usr/local/etc/php-fpm.d/docker.conf /usr/local/etc/php-fpm.d/00-docker.conf \ - && mv /usr/local/etc/php-fpm.d/www.conf /usr/local/etc/php-fpm.d/10-www.conf \ - && mv /usr/local/etc/php-fpm.d/zz-docker.conf /usr/local/etc/php-fpm.d/20-docker.conf \ # Install PrivateBin - && apk add --no-cache gnupg \ + && apk add --no-cache gnupg curl \ && export GNUPGHOME="$(mktemp -d)" \ && gpg2 --list-public-keys || /bin/true \ && curl -s https://privatebin.info/key/release.asc | gpg2 --import - \ @@ -54,14 +39,13 @@ RUN \ && mv vendor /srv \ && mkdir -p /srv/data \ && sed -i "s#define('PATH', '');#define('PATH', '/srv/');#" index.php \ - && chown -R www-data.www-data /var/www /srv/* \ + && chown -R nobody.www-data /var/www /srv/* \ && rm -rf "${GNUPGHOME}" /tmp/* \ - && apk del --no-cache gnupg + && apk del --no-cache gnupg curl WORKDIR /var/www ADD etc/ /etc/ -ADD usr/ /usr/ # mark dirs as volumes that need to be writable, allows running the container --read-only VOLUME /srv/data /tmp /var/tmp /run /var/log diff --git a/etc/php7/conf.d/00-docker.ini b/etc/php7/conf.d/00-docker.ini new file mode 100644 index 0000000..7bb479d --- /dev/null +++ b/etc/php7/conf.d/00-docker.ini @@ -0,0 +1,60 @@ +; session.use_strict_mode specifies whether the module will use strict session id mode. If this +; mode is enabled, the module does not accept uninitialized session ID. If uninitialized session ID +; is sent from browser, new session ID is sent to browser. Applications are protected from session +; fixation via session adoption with strict mode. Defaults to 0 (disabled). +session.use_strict_mode=On + +; Enable assert() evaluation. +assert.active=Off + +; This determines whether errors should be printed to the screen as part of the output or if they +; should be hidden from the user. Value "stderr" sends the errors to stderr instead of stdout. +display_errors=Off + +; Tells whether script error messages should be logged to the server's error log or error_log. +; You're strongly advised to use error logging in place of error displaying on production web sites. +log_errors=On + + + +; best practices + +; Disable deprecated short open tags ("