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