You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Dockerfile 4.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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. ENV PHP_EXTRA_CONFIGURE_ARGS --enable-maintainer-zts --enable-pthreads
  27. ENV GPG_KEYS 1A4E8B7277C42E53DBA9C7B9BCAA30EA9C0D5763
  28. ENV PHP_VERSION 7.0.7
  29. ENV PHP_FILENAME php-7.0.7.tar.xz
  30. ENV PHP_SHA256 9cc64a7459242c79c10e79d74feaf5bae3541f604966ceb600c3d2e8f5fe4794
  31. RUN set -xe \
  32. && buildDeps=" \
  33. libcurl4-openssl-dev \
  34. libedit-dev \
  35. libsqlite3-dev \
  36. libssl-dev \
  37. libxml2-dev \
  38. xz-utils \
  39. " \
  40. && apt-get update \
  41. && apt-get install -y $buildDeps --no-install-recommends \
  42. && rm -rf /var/lib/apt/lists/* \
  43. && curl -fSL "http://php.net/get/$PHP_FILENAME/from/this/mirror" -o "$PHP_FILENAME" \
  44. && echo "$PHP_SHA256 *$PHP_FILENAME" | sha256sum -c - \
  45. && curl -fSL "http://php.net/get/$PHP_FILENAME.asc/from/this/mirror" -o "$PHP_FILENAME.asc" \
  46. && export GNUPGHOME="$(mktemp -d)" \
  47. && for key in $GPG_KEYS; do \
  48. gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \
  49. done \
  50. && gpg --batch --verify "$PHP_FILENAME.asc" "$PHP_FILENAME" \
  51. && rm -r "$GNUPGHOME" "$PHP_FILENAME.asc" \
  52. && mkdir -p /usr/src/php \
  53. && tar -xf "$PHP_FILENAME" -C /usr/src/php --strip-components=1 \
  54. && rm "$PHP_FILENAME" \
  55. && cd /usr/src/php \
  56. && ./configure \
  57. --with-config-file-path="$PHP_INI_DIR" \
  58. --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \
  59. $PHP_EXTRA_CONFIGURE_ARGS \
  60. --disable-cgi \
  61. --enable-mysqlnd \
  62. --enable-mbstring \
  63. --with-curl \
  64. --with-libedit \
  65. --with-openssl \
  66. --with-zlib \
  67. && make -j"$(nproc)" \
  68. && make install \
  69. && { find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; } \
  70. && make clean \
  71. && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false -o APT::AutoRemove::SuggestsImportant=false $buildDeps
  72. RUN pecl install pthreads
  73. # Install Composer
  74. # ======================================================================================================================
  75. RUN curl https://getcomposer.org/composer.phar -o /usr/local/bin/composer \
  76. && chmod +x /usr/local/bin/composer
  77. RUN apt-get update \
  78. && apt-get install -y git unzip --no-install-recommends \
  79. && rm -rf /var/lib/apt/lists/*
  80. # Add pdo and db drivers
  81. # ======================================================================================================================
  82. COPY docker-php-ext-* /usr/local/bin/
  83. RUN buildDeps="libpq-dev libzip-dev " \
  84. && apt-get update \
  85. && apt-get install -y $buildDeps --no-install-recommends \
  86. && rm -rf /var/lib/apt/lists/* \
  87. && docker-php-ext-install pdo pdo_pgsql pgsql
  88. # Install PHP config file
  89. # ======================================================================================================================
  90. COPY php-cli.ini "${PHP_INI_DIR}"/
  91. # Install sshd
  92. # ======================================================================================================================
  93. RUN apt-get update \
  94. && apt-get install -y openssh-server --no-install-recommends \
  95. && rm -rf /var/lib/apt/lists/*
  96. RUN mkdir /var/run/sshd
  97. RUN echo 'root:toor' | chpasswd
  98. RUN sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config
  99. RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
  100. # Run everything
  101. # ======================================================================================================================
  102. WORKDIR /data
  103. VOLUME ["/data"]
  104. EXPOSE 22
  105. CMD ["/usr/sbin/sshd", "-D"]