Pārlūkot izejas kodu

try another base image

ksieren 3 gadi atpakaļ
vecāks
revīzija
718ec35808
4 mainītis faili ar 152 papildinājumiem un 39 dzēšanām
  1. 42 35
      Dockerfile
  2. 40 4
      README.md
  3. 14 0
      rootfs/etc/php7/conf.d/custom.ini
  4. 56 0
      rootfs/etc/php7/php-fpm.d/www.conf

+ 42 - 35
Dockerfile

@@ -1,43 +1,48 @@
-ARG ARCH=
-FROM ${ARCH}alpine:3.10
+FROM php:7.4.15-fpm-alpine3.12
 
 LABEL Maintainer="kerstin Sieren <kerstin@sieren.biz>" \
       Description="Lightweight container with Nginx & PHP-FPM based on Alpine Linux."
 
+RUN apk --update add --virtual build-dependencies build-base openssl-dev autoconf \
+&& pecl install mongodb \
+&& docker-php-ext-enable mongodb \
+&& apk del build-dependencies build-base openssl-dev autoconf \
+&& rm -rf /var/cache/apk/*
+
+
 # Install packages
 RUN apk --no-cache add \
-        php7 \
-        php7-fpm \
-        php7-opcache \
-        php7-pecl-apcu \
-        php7-mysqli \
-        php7-pgsql \
-        php7-json \
-        php7-openssl \
-        php7-curl \
-        php7-zlib \
-        php7-soap \
-        php7-xml \
-        php7-fileinfo \
-        php7-phar \
-        php7-intl \
-        php7-dom \
-        php7-xmlreader \
-        php7-ctype \
-        php7-session \
-        php7-iconv \
-        php7-tokenizer \
-        php7-zip \
-        php7-simplexml \
-        php7-mbstring \
-        php7-gd \
-        php7-pdo_mysql \
-        php7-pdo_pgsql \
-        php7-pdo_sqlite \
-        nginx \
-        runit \
-        curl \
-        tar \
+    php7-fpm \
+    php7-opcache \
+    php7-pecl-apcu \
+    php7-mysqli \
+    php7-pgsql \
+    php7-json \
+    php7-openssl \
+    php7-curl \
+    php7-zlib \
+    php7-soap \
+    php7-xml \
+    php7-fileinfo \
+    php7-phar \
+    php7-intl \
+    php7-dom \
+    php7-xmlreader \
+    php7-ctype \
+    php7-session \
+    php7-iconv \
+    php7-tokenizer \
+    php7-zip \
+    php7-simplexml \
+    php7-mbstring \
+    php7-gd \
+    php7-pdo_mysql \
+    php7-pdo_pgsql \
+    php7-pdo_sqlite \
+    nginx \
+    runit \
+    curl \
+    tar \
 # Bring in gettext so we can get `envsubst`, then throw
 # the rest away. To do this, we need to install `gettext`
 # then move `envsubst` out of the way so `gettext` can
@@ -62,7 +67,9 @@ RUN apk --no-cache add \
     && chown -R nobody.nobody /run \
     && chown -R nobody.nobody /var/lib/nginx \
     && chown -R nobody.nobody /var/log/nginx \
-    && chown -R nobody.nobody /var/log/php7
+    && chown -R nobody:nobody /etc/php7 \
+    && chown -R nobody.nobody /var/log/ \
+    && chown -R nobody.nobody /tmp
 
 RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer
 

+ 40 - 4
README.md

@@ -1,7 +1,43 @@
-# Docker PHP-FPM 8.1 & Nginx 1.22 on Alpine Linux
-
-
-Example PHP-FPM 8.1 & Nginx 1.22 setup for Docker, build on [Alpine Linux](https://www.alpinelinux.org/).
+RUN apk --update add --virtual build-dependencies build-base openssl-dev autoconf \
+&& pecl install mongodb \
+&& docker-php-ext-enable mongodb \
+&& apk del build-dependencies build-base openssl-dev autoconf \
+&& rm -rf /var/cache/apk/*
+
+
+        php7-opcache \
+        php7-pecl-apcu \
+        php7-mysqli \
+        php7-pgsql \
+        php7-json \
+        php7-openssl \
+        php7-curl \
+        php7-zlib \
+        php7-soap \
+        php7-xml \
+        php7-fileinfo \
+        php7-phar \
+        php7-intl \
+        php7-dom \
+        php7-xmlreader \
+        php7-ctype \
+        php7-session \
+        php7-iconv \
+        php7-tokenizer \
+        php7-zip \
+        php7-simplexml \
+        php7-mbstring \
+        php7-gd \
+        php7-pdo_mysql \
+        php7-pdo_pgsql \
+        php7-pdo_sqlite \
+
+
+
+# Docker PHP-FPM 7.4 & Nginx 1.16 on Alpine Linux
+
+
+Example PHP-FPM 7.4 & Nginx 1.16 setup for Docker, build on [Alpine Linux](https://www.alpinelinux.org/).
 The image is only +/- 25MB large.
 
 Repository: https://git2.meramo.org/Infrastructure/alpine-phpfpm-nginx-baseimage.git

+ 14 - 0
rootfs/etc/php7/conf.d/custom.ini

@@ -0,0 +1,14 @@
+[Date]
+date.timezone="UTC"
+
+allow_url_fopen = $allow_url_fopen
+allow_url_include= $allow_url_include
+display_errors= $display_errors
+file_uploads= $file_uploads
+max_execution_time= $max_execution_time
+max_input_time= $max_input_time
+max_input_vars= $max_input_vars
+memory_limit= $memory_limit
+post_max_size= $post_max_size
+upload_max_filesize= $upload_max_filesize
+zlib.output_compression= $zlib.output_compression

+ 56 - 0
rootfs/etc/php7/php-fpm.d/www.conf

@@ -0,0 +1,56 @@
+[global]
+; Log to stderr
+error_log = /dev/stderr
+
+[www]
+; The address on which to accept FastCGI requests.
+; Valid syntaxes are:
+;   'ip.add.re.ss:port'    - to listen on a TCP socket to a specific IPv4 address on
+;                            a specific port;
+;   '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on
+;                            a specific port;
+;   'port'                 - to listen on a TCP socket to all addresses
+;                            (IPv6 and IPv4-mapped) on a specific port;
+;   '/path/to/unix/socket' - to listen on a unix socket.
+; Note: This value is mandatory.
+listen = 127.0.0.1:9000
+
+; Enable status page
+pm.status_path = /fpm-status
+
+; Ondemand process manager
+pm = ondemand
+
+; The number of child processes to be created when pm is set to 'static' and the
+; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'.
+; This value sets the limit on the number of simultaneous requests that will be
+; served. Equivalent to the ApacheMaxClients directive with mpm_prefork.
+; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP
+; CGI. The below defaults are based on a server without much resources. Don't
+; forget to tweak pm.* to fit your needs.
+; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand'
+; Note: This value is mandatory.
+pm.max_children = 100
+
+; The number of seconds after which an idle process will be killed.
+; Note: Used only when pm is set to 'ondemand'
+; Default Value: 10s
+pm.process_idle_timeout = 10s;
+
+; The number of requests each child process should execute before respawning.
+; This can be useful to work around memory leaks in 3rd party libraries. For
+; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS.
+; Default Value: 0
+pm.max_requests = 1000
+
+; Make sure the FPM workers can reach the environment variables for configuration
+clear_env = $clear_env
+
+; Catch output from PHP
+catch_workers_output = yes
+
+; Remove the 'child 10 said into stderr' prefix in the log and only show the actual message
+decorate_workers_output = no
+
+; Enable ping page to use in healthcheck
+ping.path = /fpm-ping