Dockerfile 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. ARG ARCH=
  2. FROM ${ARCH}alpine:3.15
  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-pecl-mongodb \
  33. php7-pdo_mysql \
  34. php7-pdo_pgsql \
  35. php7-pdo_sqlite \
  36. nginx \
  37. runit \
  38. curl \
  39. tar \
  40. # Bring in gettext so we can get `envsubst`, then throw
  41. # the rest away. To do this, we need to install `gettext`
  42. # then move `envsubst` out of the way so `gettext` can
  43. # be deleted completely, then move `envsubst` back.
  44. && apk add --no-cache --virtual .gettext gettext \
  45. && mv /usr/bin/envsubst /tmp/ \
  46. && runDeps="$( \
  47. scanelf --needed --nobanner /tmp/envsubst \
  48. | awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \
  49. | sort -u \
  50. | xargs -r apk info --installed \
  51. | sort -u \
  52. )" \
  53. && apk add --no-cache $runDeps \
  54. && apk del .gettext \
  55. && mv /tmp/envsubst /usr/local/bin/ \
  56. # Remove alpine cache
  57. && rm -rf /var/cache/apk/* \
  58. # Remove default server definition
  59. && rm /etc/nginx/http.d/default.conf \
  60. # Make sure files/folders needed by the processes are accessable when they run under the nobody user
  61. && chown -R nobody.nobody /run \
  62. && chown -R nobody.nobody /var/lib/nginx \
  63. && chown -R nobody.nobody /var/log/nginx
  64. RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer
  65. # Add configuration files
  66. COPY --chown=nobody rootfs/ /
  67. # Switch to use a non-root user from here on
  68. USER nobody
  69. # Add application
  70. WORKDIR /var/www/html
  71. # Expose the port nginx is reachable on
  72. EXPOSE 8080
  73. # Let runit start nginx & php-fpm
  74. CMD [ "/bin/docker-entrypoint.sh" ]
  75. # Configure a healthcheck to validate that everything is up&running
  76. HEALTHCHECK --timeout=10s CMD curl --silent --fail http://127.0.0.1:8080/fpm-ping
  77. ENV client_max_body_size=5M \
  78. clear_env=no \
  79. allow_url_fopen=On \
  80. allow_url_include=Off \
  81. display_errors=Off \
  82. file_uploads=On \
  83. max_execution_time=0 \
  84. max_input_time=-1 \
  85. max_input_vars=1000 \
  86. memory_limit=128M \
  87. post_max_size=8M \
  88. upload_max_filesize=5M \
  89. variables_order="EGPCS" \
  90. zlib.output_compression=On