Dockerfile 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. ARG ARCH=
  2. FROM ${ARCH}alpine:3.10
  3. LABEL Maintainer="kerstin Sieren <kerstin@sieren.biz>" \
  4. Description="Lightweight container with Nginx & PHP-FPM based on Alpine Linux."
  5. # Install packages
  6. RUN apk --no-cache add \
  7. php7 \
  8. php7-fpm \
  9. php7-opcache \
  10. php7-pecl-apcu \
  11. php7-mysqli \
  12. php7-pgsql \
  13. php7-json \
  14. php7-openssl \
  15. php7-curl \
  16. php7-zlib \
  17. php7-soap \
  18. php7-xml \
  19. php7-fileinfo \
  20. php7-phar \
  21. php7-intl \
  22. php7-dom \
  23. php7-xmlreader \
  24. php7-ctype \
  25. php7-session \
  26. php7-iconv \
  27. php7-tokenizer \
  28. php7-zip \
  29. php7-simplexml \
  30. php7-mbstring \
  31. php7-gd \
  32. php7-pdo_mysql \
  33. php7-pdo_pgsql \
  34. php7-pdo_sqlite \
  35. nginx \
  36. runit \
  37. curl \
  38. tar \
  39. # Bring in gettext so we can get `envsubst`, then throw
  40. # the rest away. To do this, we need to install `gettext`
  41. # then move `envsubst` out of the way so `gettext` can
  42. # be deleted completely, then move `envsubst` back.
  43. && apk add --no-cache --virtual .gettext gettext \
  44. && mv /usr/bin/envsubst /tmp/ \
  45. && runDeps="$( \
  46. scanelf --needed --nobanner /tmp/envsubst \
  47. | awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \
  48. | sort -u \
  49. | xargs -r apk info --installed \
  50. | sort -u \
  51. )" \
  52. && apk add --no-cache $runDeps \
  53. && apk del .gettext \
  54. && mv /tmp/envsubst /usr/local/bin/ \
  55. # Remove alpine cache
  56. && rm -rf /var/cache/apk/* \
  57. # Remove default server definition
  58. # && rm /etc/nginx/http.d/default.conf \
  59. # Make sure files/folders needed by the processes are accessable when they run under the nobody user
  60. && chown -R nobody.nobody /run \
  61. && chown -R nobody.nobody /var/lib/nginx \
  62. && chown -R nobody.nobody /var/log/nginx
  63. RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer
  64. # Add configuration files
  65. COPY --chown=nobody rootfs/ /
  66. # Switch to use a non-root user from here on
  67. USER nobody
  68. # Add application
  69. WORKDIR /var/www/html
  70. # Expose the port nginx is reachable on
  71. EXPOSE 8080
  72. # Let runit start nginx & php-fpm
  73. CMD [ "/bin/docker-entrypoint.sh" ]
  74. # Configure a healthcheck to validate that everything is up&running
  75. HEALTHCHECK --timeout=10s CMD curl --silent --fail http://127.0.0.1:8080/fpm-ping
  76. ENV client_max_body_size=2M \
  77. clear_env=no \
  78. allow_url_fopen=On \
  79. allow_url_include=Off \
  80. display_errors=Off \
  81. file_uploads=On \
  82. max_execution_time=0 \
  83. max_input_time=-1 \
  84. max_input_vars=1000 \
  85. memory_limit=128M \
  86. post_max_size=8M \
  87. upload_max_filesize=2M \
  88. zlib.output_compression=On