Dockerfile 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. FROM php:7.4-cli-alpine
  2. ENV PHPIZE_DEPS \
  3. autoconf \
  4. cmake \
  5. file \
  6. g++ \
  7. gcc \
  8. libc-dev \
  9. pcre-dev \
  10. make \
  11. git \
  12. pkgconf \
  13. re2c \
  14. # for intl extension
  15. icu-dev \
  16. # for zip extension
  17. libzip-dev
  18. RUN apk add --update --no-cache --virtual .persistent-deps \
  19. # for intl extension
  20. icu-libs \
  21. # for mbstring
  22. oniguruma-dev \
  23. # for zip
  24. libzip \
  25. libgcrypt
  26. # Compile and install extensions
  27. RUN set -xe \
  28. && apk add --no-cache --virtual .build-deps $PHPIZE_DEPS \
  29. && docker-php-ext-configure intl --enable-intl \
  30. && docker-php-ext-configure mbstring --enable-mbstring \
  31. && docker-php-ext-configure opcache --enable-opcache \
  32. && docker-php-ext-install -j$(nproc) \
  33. intl \
  34. mbstring \
  35. opcache \
  36. zip \
  37. && pecl install xdebug \
  38. && apk del .build-deps
  39. # Install Blackfire PHP probe
  40. RUN set -xe \
  41. && version=$(php -r "echo PHP_MAJOR_VERSION.PHP_MINOR_VERSION;") \
  42. && curl -A "Docker" -o /tmp/blackfire-probe.tar.gz -D - -L -s https://blackfire.io/api/v1/releases/probe/php/alpine/amd64/$version \
  43. && mkdir -p /tmp/blackfire \
  44. && tar zxpf /tmp/blackfire-probe.tar.gz -C /tmp/blackfire \
  45. && mv /tmp/blackfire/blackfire-*.so $(php -r "echo ini_get ('extension_dir');")/blackfire.so \
  46. && printf "extension=blackfire.so\nblackfire.agent_socket=tcp://blackfire:8307\n" > $PHP_INI_DIR/conf.d/blackfire.ini \
  47. && rm -rf /tmp/blackfire /tmp/blackfire-probe.tar.gz
  48. # Install Blackfire client
  49. RUN set -xe \
  50. && mkdir -p /tmp/blackfire \
  51. && curl -A "Docker" -o /tmp/blackfire/blackfire -D - -L -s https://packages.blackfire.io/binaries/blackfire/2.4.3/blackfire-linux_amd64 \
  52. && mv /tmp/blackfire/blackfire /usr/bin/blackfire \
  53. && chmod +x /usr/bin/blackfire \
  54. && rm -Rf /tmp/blackfire
  55. # Install Composer
  56. RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer
  57. # Install other needed binaries
  58. RUN apk add --no-cache --update patch git
  59. # Configure PHP
  60. COPY config/php.ini /usr/local/etc/php/conf.d/
  61. COPY config/opcache.ini /usr/local/etc/php/conf.d/
  62. COPY config/xdebug.ini /usr/local/etc/php/conf.d/
  63. VOLUME ["/app"]
  64. WORKDIR /app