Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

Dockerfile 5.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. FROM debian:jessie
  2. MAINTAINER Robin Thoni <robin@rthoni.com>
  3. # Build php
  4. # ======================================================================================================================
  5. ENV PHPIZE_DEPS \
  6. autoconf \
  7. file \
  8. g++ \
  9. gcc \
  10. libc-dev \
  11. make \
  12. pkg-config \
  13. re2c
  14. RUN apt-get update \
  15. && apt-get install -y \
  16. $PHPIZE_DEPS \
  17. ca-certificates \
  18. curl \
  19. libedit2 \
  20. libsqlite3-0 \
  21. libxml2 \
  22. --no-install-recommends \
  23. && rm -r /var/lib/apt/lists/*
  24. ENV PHP_INI_DIR /etc/php7.0
  25. RUN mkdir -p $PHP_INI_DIR/conf.d
  26. RUN apt-get update \
  27. && apt-get install -y apache2-bin apache2.2-common --no-install-recommends \
  28. && rm -rf /var/lib/apt/lists/*
  29. RUN rm -rf /var/www/html \
  30. && mkdir -p /var/lock/apache2 /var/run/apache2 /var/log/apache2 /var/www/html \
  31. && chown -R www-data:www-data /var/lock/apache2 /var/run/apache2 /var/log/apache2 /var/www/html
  32. RUN a2dismod mpm_event \
  33. && a2enmod mpm_prefork
  34. RUN mv /etc/apache2/apache2.conf /etc/apache2/apache2.conf.dist \
  35. && rm /etc/apache2/conf-enabled/* /etc/apache2/sites-enabled/*
  36. COPY apache2.conf /etc/apache2/apache2.conf
  37. ENV PHP_EXTRA_BUILD_DEPS apache2-dev
  38. ENV PHP_EXTRA_CONFIGURE_ARGS --with-apxs2 --enable-maintainer-zts --enable-pthreads
  39. ENV GPG_KEYS 1A4E8B7277C42E53DBA9C7B9BCAA30EA9C0D5763
  40. ENV PHP_VERSION 7.0.7
  41. ENV PHP_FILENAME php-7.0.7.tar.xz
  42. ENV PHP_SHA256 9cc64a7459242c79c10e79d74feaf5bae3541f604966ceb600c3d2e8f5fe4794
  43. RUN set -xe \
  44. && buildDeps=" \
  45. $PHP_EXTRA_BUILD_DEPS \
  46. libcurl4-openssl-dev \
  47. libedit-dev \
  48. libsqlite3-dev \
  49. libssl-dev \
  50. libxml2-dev \
  51. xz-utils \
  52. " \
  53. && apt-get update \
  54. && apt-get install -y $buildDeps --no-install-recommends \
  55. && rm -rf /var/lib/apt/lists/* \
  56. && curl -fSL "http://php.net/get/$PHP_FILENAME/from/this/mirror" -o "$PHP_FILENAME" \
  57. && echo "$PHP_SHA256 *$PHP_FILENAME" | sha256sum -c - \
  58. && curl -fSL "http://php.net/get/$PHP_FILENAME.asc/from/this/mirror" -o "$PHP_FILENAME.asc" \
  59. && export GNUPGHOME="$(mktemp -d)" \
  60. && for key in $GPG_KEYS; do \
  61. gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \
  62. done \
  63. && gpg --batch --verify "$PHP_FILENAME.asc" "$PHP_FILENAME" \
  64. && rm -r "$GNUPGHOME" "$PHP_FILENAME.asc" \
  65. && mkdir -p /usr/src/php \
  66. && tar -xf "$PHP_FILENAME" -C /usr/src/php --strip-components=1 \
  67. && rm "$PHP_FILENAME" \
  68. && cd /usr/src/php \
  69. && ./configure \
  70. --with-config-file-path="$PHP_INI_DIR" \
  71. --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \
  72. $PHP_EXTRA_CONFIGURE_ARGS \
  73. --disable-cgi \
  74. --enable-mysqlnd \
  75. --enable-mbstring \
  76. --with-curl \
  77. --with-libedit \
  78. --with-openssl \
  79. --with-zlib \
  80. && make -j"$(nproc)" \
  81. && make install \
  82. && { find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; } \
  83. && make clean \
  84. && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false -o APT::AutoRemove::SuggestsImportant=false $buildDeps
  85. RUN ln -sf /dev/stdout /var/log/apache2/access.log \
  86. && ln -sf /dev/stderr /var/log/apache2/error.log \
  87. && ln -sf /dev/stdout /var/log/websocket.log \
  88. && ln -sf /dev/stderr /var/log/websocket.err \
  89. && a2enmod rewrite \
  90. && rm -rf /var/www/* \
  91. && chown -R www-data:www-data /var/www
  92. RUN pecl install pthreads
  93. # Install Composer
  94. # ======================================================================================================================
  95. RUN curl https://getcomposer.org/composer.phar -o /usr/local/bin/composer \
  96. && chmod +x /usr/local/bin/composer
  97. RUN apt-get update \
  98. && apt-get install -y git unzip --no-install-recommends \
  99. && rm -rf /var/lib/apt/lists/*
  100. # Add pdo and db drivers
  101. # ======================================================================================================================
  102. COPY docker-php-ext-* /usr/local/bin/
  103. RUN buildDeps="libpq-dev libzip-dev " \
  104. && apt-get update \
  105. && apt-get install -y $buildDeps --no-install-recommends \
  106. && rm -rf /var/lib/apt/lists/* \
  107. && docker-php-ext-install pdo pdo_pgsql pgsql
  108. # Install PHP config files
  109. # ======================================================================================================================
  110. COPY php-cli.ini "${PHP_INI_DIR}"/
  111. COPY php-apache.ini "${PHP_INI_DIR}"/php-apache2handler.ini
  112. # Run everything
  113. # ======================================================================================================================
  114. COPY run.sh /usr/local/bin/
  115. WORKDIR /var/www
  116. EXPOSE 8180
  117. EXPOSE 80
  118. VOLUME ["/var/www"]
  119. CMD ["run.sh"]