Skip to content

Commit 050469e

Browse files
committedNov 7, 2014
Merge pull request #36 from infosiftr/slim-build
Refactor Dockerfile, switching the base from `buildpack-deps` over to `debian` directly
2 parents c1fe2a2 + a6e6a63 commit 050469e

9 files changed

+198
-93
lines changed
 

‎5.4/Dockerfile

+26-12
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,30 @@
1-
FROM buildpack-deps:jessie
1+
FROM debian:jessie
22

3-
RUN apt-get update && apt-get install -y curl && rm -r /var/lib/apt/lists/*
3+
# persistent / runtime deps
4+
RUN apt-get update && apt-get install -y curl libxml2 --no-install-recommends && rm -r /var/lib/apt/lists/*
45

5-
##<apache2>##
6-
##</apache2>##
6+
##<autogenerated>##
7+
##</autogenerated>##
78

89
RUN gpg --keyserver pgp.mit.edu --recv-keys F38252826ACD957EF380D39F2F7956BC5DA04B5D
910

1011
ENV PHP_VERSION 5.4.34
1112

12-
RUN set -x \
13-
&& curl -SLO http://launchpadlibrarian.net/140087283/libbison-dev_2.7.1.dfsg-1_amd64.deb \
14-
&& curl -SLO http://launchpadlibrarian.net/140087282/bison_2.7.1.dfsg-1_amd64.deb \
15-
&& dpkg -i libbison-dev_2.7.1.dfsg-1_amd64.deb \
16-
&& dpkg -i bison_2.7.1.dfsg-1_amd64.deb \
17-
&& rm *.deb \
13+
RUN buildDeps=" \
14+
$PHP_EXTRA_BUILD_DEPS \
15+
build-essential \
16+
bzip2 \
17+
file \
18+
libcurl4-openssl-dev \
19+
libpng12-dev \
20+
libreadline6-dev \
21+
libssl-dev \
22+
libxml2-dev \
23+
m4 \
24+
pkg-config \
25+
"; \
26+
set -x \
27+
&& apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \
1828
&& curl -SL "http://php.net/get/php-$PHP_VERSION.tar.bz2/from/this/mirror" -o php.tar.bz2 \
1929
&& curl -SL "http://php.net/get/php-$PHP_VERSION.tar.bz2.asc/from/this/mirror" -o php.tar.bz2.asc \
2030
&& gpg --verify php.tar.bz2.asc \
@@ -23,17 +33,21 @@ RUN set -x \
2333
&& rm php.tar.bz2* \
2434
&& cd /usr/src/php \
2535
&& ./configure --disable-cgi \
26-
$(command -v apxs2 > /dev/null 2>&1 && echo '--with-apxs2' || true) \
36+
$PHP_EXTRA_CONFIGURE_ARGS \
2737
--with-curl \
2838
--with-gd \
2939
--with-mysql \
3040
--with-mysqli \
3141
--with-openssl \
3242
--with-pdo-mysql \
43+
--with-readline \
3344
--with-zlib \
3445
&& make -j"$(nproc)" \
3546
&& make install \
36-
&& dpkg -r bison libbison-dev \
47+
&& { find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; } \
48+
&& apt-get purge -y --auto-remove $buildDeps \
3749
&& rm -r /usr/src/php
3850

51+
##<autogenerated>##
3952
CMD ["php", "-a"]
53+
##</autogenerated>##

‎5.4/apache/Dockerfile

+31-13
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
FROM buildpack-deps:jessie
1+
FROM debian:jessie
22

3-
RUN apt-get update && apt-get install -y curl && rm -r /var/lib/apt/lists/*
3+
# persistent / runtime deps
4+
RUN apt-get update && apt-get install -y curl libxml2 --no-install-recommends && rm -r /var/lib/apt/lists/*
45

5-
##<apache2>##
6-
RUN apt-get update && apt-get install -y apache2-bin apache2-dev apache2.2-common --no-install-recommends && rm -rf /var/lib/apt/lists/*
6+
##<autogenerated>##
7+
RUN apt-get update && apt-get install -y apache2-bin apache2.2-common --no-install-recommends && rm -rf /var/lib/apt/lists/*
78

89
RUN rm -rf /var/www/html && mkdir -p /var/lock/apache2 /var/run/apache2 /var/log/apache2 /var/www/html && chown -R www-data:www-data /var/lock/apache2 /var/run/apache2 /var/log/apache2 /var/www/html
910

@@ -12,18 +13,31 @@ RUN a2dismod mpm_event && a2enmod mpm_prefork
1213

1314
RUN mv /etc/apache2/apache2.conf /etc/apache2/apache2.conf.dist
1415
COPY apache2.conf /etc/apache2/apache2.conf
15-
##</apache2>##
16+
# it'd be nice if we could not COPY apache2.conf until the end of the Dockerfile, but its contents are checked by PHP during compilation
17+
18+
ENV PHP_EXTRA_BUILD_DEPS apache2-dev
19+
ENV PHP_EXTRA_CONFIGURE_ARGS --with-apxs2
20+
##</autogenerated>##
1621

1722
RUN gpg --keyserver pgp.mit.edu --recv-keys F38252826ACD957EF380D39F2F7956BC5DA04B5D
1823

1924
ENV PHP_VERSION 5.4.34
2025

21-
RUN set -x \
22-
&& curl -SLO http://launchpadlibrarian.net/140087283/libbison-dev_2.7.1.dfsg-1_amd64.deb \
23-
&& curl -SLO http://launchpadlibrarian.net/140087282/bison_2.7.1.dfsg-1_amd64.deb \
24-
&& dpkg -i libbison-dev_2.7.1.dfsg-1_amd64.deb \
25-
&& dpkg -i bison_2.7.1.dfsg-1_amd64.deb \
26-
&& rm *.deb \
26+
RUN buildDeps=" \
27+
$PHP_EXTRA_BUILD_DEPS \
28+
build-essential \
29+
bzip2 \
30+
file \
31+
libcurl4-openssl-dev \
32+
libpng12-dev \
33+
libreadline6-dev \
34+
libssl-dev \
35+
libxml2-dev \
36+
m4 \
37+
pkg-config \
38+
"; \
39+
set -x \
40+
&& apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \
2741
&& curl -SL "http://php.net/get/php-$PHP_VERSION.tar.bz2/from/this/mirror" -o php.tar.bz2 \
2842
&& curl -SL "http://php.net/get/php-$PHP_VERSION.tar.bz2.asc/from/this/mirror" -o php.tar.bz2.asc \
2943
&& gpg --verify php.tar.bz2.asc \
@@ -32,20 +46,24 @@ RUN set -x \
3246
&& rm php.tar.bz2* \
3347
&& cd /usr/src/php \
3448
&& ./configure --disable-cgi \
35-
$(command -v apxs2 > /dev/null 2>&1 && echo '--with-apxs2' || true) \
49+
$PHP_EXTRA_CONFIGURE_ARGS \
3650
--with-curl \
3751
--with-gd \
3852
--with-mysql \
3953
--with-mysqli \
4054
--with-openssl \
4155
--with-pdo-mysql \
56+
--with-readline \
4257
--with-zlib \
4358
&& make -j"$(nproc)" \
4459
&& make install \
45-
&& dpkg -r bison libbison-dev \
60+
&& { find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; } \
61+
&& apt-get purge -y --auto-remove $buildDeps \
4662
&& rm -r /usr/src/php
4763

64+
##<autogenerated>##
4865
WORKDIR /var/www/html
4966

5067
EXPOSE 80
5168
CMD ["apache2", "-DFOREGROUND"]
69+
##</autogenerated>##

‎5.5/Dockerfile

+26-12
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,30 @@
1-
FROM buildpack-deps:jessie
1+
FROM debian:jessie
22

3-
RUN apt-get update && apt-get install -y curl && rm -r /var/lib/apt/lists/*
3+
# persistent / runtime deps
4+
RUN apt-get update && apt-get install -y curl libxml2 --no-install-recommends && rm -r /var/lib/apt/lists/*
45

5-
##<apache2>##
6-
##</apache2>##
6+
##<autogenerated>##
7+
##</autogenerated>##
78

89
RUN gpg --keyserver pgp.mit.edu --recv-keys 0BD78B5F97500D450838F95DFE857D9A90D90EC1 0B96609E270F565C13292B24C13C70B87267B52D
910

1011
ENV PHP_VERSION 5.5.18
1112

12-
RUN set -x \
13-
&& curl -SLO http://launchpadlibrarian.net/140087283/libbison-dev_2.7.1.dfsg-1_amd64.deb \
14-
&& curl -SLO http://launchpadlibrarian.net/140087282/bison_2.7.1.dfsg-1_amd64.deb \
15-
&& dpkg -i libbison-dev_2.7.1.dfsg-1_amd64.deb \
16-
&& dpkg -i bison_2.7.1.dfsg-1_amd64.deb \
17-
&& rm *.deb \
13+
RUN buildDeps=" \
14+
$PHP_EXTRA_BUILD_DEPS \
15+
build-essential \
16+
bzip2 \
17+
file \
18+
libcurl4-openssl-dev \
19+
libpng12-dev \
20+
libreadline6-dev \
21+
libssl-dev \
22+
libxml2-dev \
23+
m4 \
24+
pkg-config \
25+
"; \
26+
set -x \
27+
&& apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \
1828
&& curl -SL "http://php.net/get/php-$PHP_VERSION.tar.bz2/from/this/mirror" -o php.tar.bz2 \
1929
&& curl -SL "http://php.net/get/php-$PHP_VERSION.tar.bz2.asc/from/this/mirror" -o php.tar.bz2.asc \
2030
&& gpg --verify php.tar.bz2.asc \
@@ -23,17 +33,21 @@ RUN set -x \
2333
&& rm php.tar.bz2* \
2434
&& cd /usr/src/php \
2535
&& ./configure --disable-cgi \
26-
$(command -v apxs2 > /dev/null 2>&1 && echo '--with-apxs2' || true) \
36+
$PHP_EXTRA_CONFIGURE_ARGS \
2737
--with-curl \
2838
--with-gd \
2939
--with-mysql \
3040
--with-mysqli \
3141
--with-openssl \
3242
--with-pdo-mysql \
43+
--with-readline \
3344
--with-zlib \
3445
&& make -j"$(nproc)" \
3546
&& make install \
36-
&& dpkg -r bison libbison-dev \
47+
&& { find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; } \
48+
&& apt-get purge -y --auto-remove $buildDeps \
3749
&& rm -r /usr/src/php
3850

51+
##<autogenerated>##
3952
CMD ["php", "-a"]
53+
##</autogenerated>##

‎5.5/apache/Dockerfile

+31-13
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
FROM buildpack-deps:jessie
1+
FROM debian:jessie
22

3-
RUN apt-get update && apt-get install -y curl && rm -r /var/lib/apt/lists/*
3+
# persistent / runtime deps
4+
RUN apt-get update && apt-get install -y curl libxml2 --no-install-recommends && rm -r /var/lib/apt/lists/*
45

5-
##<apache2>##
6-
RUN apt-get update && apt-get install -y apache2-bin apache2-dev apache2.2-common --no-install-recommends && rm -rf /var/lib/apt/lists/*
6+
##<autogenerated>##
7+
RUN apt-get update && apt-get install -y apache2-bin apache2.2-common --no-install-recommends && rm -rf /var/lib/apt/lists/*
78

89
RUN rm -rf /var/www/html && mkdir -p /var/lock/apache2 /var/run/apache2 /var/log/apache2 /var/www/html && chown -R www-data:www-data /var/lock/apache2 /var/run/apache2 /var/log/apache2 /var/www/html
910

@@ -12,18 +13,31 @@ RUN a2dismod mpm_event && a2enmod mpm_prefork
1213

1314
RUN mv /etc/apache2/apache2.conf /etc/apache2/apache2.conf.dist
1415
COPY apache2.conf /etc/apache2/apache2.conf
15-
##</apache2>##
16+
# it'd be nice if we could not COPY apache2.conf until the end of the Dockerfile, but its contents are checked by PHP during compilation
17+
18+
ENV PHP_EXTRA_BUILD_DEPS apache2-dev
19+
ENV PHP_EXTRA_CONFIGURE_ARGS --with-apxs2
20+
##</autogenerated>##
1621

1722
RUN gpg --keyserver pgp.mit.edu --recv-keys 0BD78B5F97500D450838F95DFE857D9A90D90EC1 0B96609E270F565C13292B24C13C70B87267B52D
1823

1924
ENV PHP_VERSION 5.5.18
2025

21-
RUN set -x \
22-
&& curl -SLO http://launchpadlibrarian.net/140087283/libbison-dev_2.7.1.dfsg-1_amd64.deb \
23-
&& curl -SLO http://launchpadlibrarian.net/140087282/bison_2.7.1.dfsg-1_amd64.deb \
24-
&& dpkg -i libbison-dev_2.7.1.dfsg-1_amd64.deb \
25-
&& dpkg -i bison_2.7.1.dfsg-1_amd64.deb \
26-
&& rm *.deb \
26+
RUN buildDeps=" \
27+
$PHP_EXTRA_BUILD_DEPS \
28+
build-essential \
29+
bzip2 \
30+
file \
31+
libcurl4-openssl-dev \
32+
libpng12-dev \
33+
libreadline6-dev \
34+
libssl-dev \
35+
libxml2-dev \
36+
m4 \
37+
pkg-config \
38+
"; \
39+
set -x \
40+
&& apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \
2741
&& curl -SL "http://php.net/get/php-$PHP_VERSION.tar.bz2/from/this/mirror" -o php.tar.bz2 \
2842
&& curl -SL "http://php.net/get/php-$PHP_VERSION.tar.bz2.asc/from/this/mirror" -o php.tar.bz2.asc \
2943
&& gpg --verify php.tar.bz2.asc \
@@ -32,20 +46,24 @@ RUN set -x \
3246
&& rm php.tar.bz2* \
3347
&& cd /usr/src/php \
3448
&& ./configure --disable-cgi \
35-
$(command -v apxs2 > /dev/null 2>&1 && echo '--with-apxs2' || true) \
49+
$PHP_EXTRA_CONFIGURE_ARGS \
3650
--with-curl \
3751
--with-gd \
3852
--with-mysql \
3953
--with-mysqli \
4054
--with-openssl \
4155
--with-pdo-mysql \
56+
--with-readline \
4257
--with-zlib \
4358
&& make -j"$(nproc)" \
4459
&& make install \
45-
&& dpkg -r bison libbison-dev \
60+
&& { find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; } \
61+
&& apt-get purge -y --auto-remove $buildDeps \
4662
&& rm -r /usr/src/php
4763

64+
##<autogenerated>##
4865
WORKDIR /var/www/html
4966

5067
EXPOSE 80
5168
CMD ["apache2", "-DFOREGROUND"]
69+
##</autogenerated>##

‎5.6/Dockerfile

+26-12
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,30 @@
1-
FROM buildpack-deps:jessie
1+
FROM debian:jessie
22

3-
RUN apt-get update && apt-get install -y curl && rm -r /var/lib/apt/lists/*
3+
# persistent / runtime deps
4+
RUN apt-get update && apt-get install -y curl libxml2 --no-install-recommends && rm -r /var/lib/apt/lists/*
45

5-
##<apache2>##
6-
##</apache2>##
6+
##<autogenerated>##
7+
##</autogenerated>##
78

89
RUN gpg --keyserver pgp.mit.edu --recv-keys 6E4F6AB321FDC07F2C332E3AC2BF0BC433CFC8B3 0BD78B5F97500D450838F95DFE857D9A90D90EC1
910

1011
ENV PHP_VERSION 5.6.2
1112

12-
RUN set -x \
13-
&& curl -SLO http://launchpadlibrarian.net/140087283/libbison-dev_2.7.1.dfsg-1_amd64.deb \
14-
&& curl -SLO http://launchpadlibrarian.net/140087282/bison_2.7.1.dfsg-1_amd64.deb \
15-
&& dpkg -i libbison-dev_2.7.1.dfsg-1_amd64.deb \
16-
&& dpkg -i bison_2.7.1.dfsg-1_amd64.deb \
17-
&& rm *.deb \
13+
RUN buildDeps=" \
14+
$PHP_EXTRA_BUILD_DEPS \
15+
build-essential \
16+
bzip2 \
17+
file \
18+
libcurl4-openssl-dev \
19+
libpng12-dev \
20+
libreadline6-dev \
21+
libssl-dev \
22+
libxml2-dev \
23+
m4 \
24+
pkg-config \
25+
"; \
26+
set -x \
27+
&& apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \
1828
&& curl -SL "http://php.net/get/php-$PHP_VERSION.tar.bz2/from/this/mirror" -o php.tar.bz2 \
1929
&& curl -SL "http://php.net/get/php-$PHP_VERSION.tar.bz2.asc/from/this/mirror" -o php.tar.bz2.asc \
2030
&& gpg --verify php.tar.bz2.asc \
@@ -23,17 +33,21 @@ RUN set -x \
2333
&& rm php.tar.bz2* \
2434
&& cd /usr/src/php \
2535
&& ./configure --disable-cgi \
26-
$(command -v apxs2 > /dev/null 2>&1 && echo '--with-apxs2' || true) \
36+
$PHP_EXTRA_CONFIGURE_ARGS \
2737
--with-curl \
2838
--with-gd \
2939
--with-mysql \
3040
--with-mysqli \
3141
--with-openssl \
3242
--with-pdo-mysql \
43+
--with-readline \
3344
--with-zlib \
3445
&& make -j"$(nproc)" \
3546
&& make install \
36-
&& dpkg -r bison libbison-dev \
47+
&& { find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; } \
48+
&& apt-get purge -y --auto-remove $buildDeps \
3749
&& rm -r /usr/src/php
3850

51+
##<autogenerated>##
3952
CMD ["php", "-a"]
53+
##</autogenerated>##

‎5.6/apache/Dockerfile

+31-13
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
FROM buildpack-deps:jessie
1+
FROM debian:jessie
22

3-
RUN apt-get update && apt-get install -y curl && rm -r /var/lib/apt/lists/*
3+
# persistent / runtime deps
4+
RUN apt-get update && apt-get install -y curl libxml2 --no-install-recommends && rm -r /var/lib/apt/lists/*
45

5-
##<apache2>##
6-
RUN apt-get update && apt-get install -y apache2-bin apache2-dev apache2.2-common --no-install-recommends && rm -rf /var/lib/apt/lists/*
6+
##<autogenerated>##
7+
RUN apt-get update && apt-get install -y apache2-bin apache2.2-common --no-install-recommends && rm -rf /var/lib/apt/lists/*
78

89
RUN rm -rf /var/www/html && mkdir -p /var/lock/apache2 /var/run/apache2 /var/log/apache2 /var/www/html && chown -R www-data:www-data /var/lock/apache2 /var/run/apache2 /var/log/apache2 /var/www/html
910

@@ -12,18 +13,31 @@ RUN a2dismod mpm_event && a2enmod mpm_prefork
1213

1314
RUN mv /etc/apache2/apache2.conf /etc/apache2/apache2.conf.dist
1415
COPY apache2.conf /etc/apache2/apache2.conf
15-
##</apache2>##
16+
# it'd be nice if we could not COPY apache2.conf until the end of the Dockerfile, but its contents are checked by PHP during compilation
17+
18+
ENV PHP_EXTRA_BUILD_DEPS apache2-dev
19+
ENV PHP_EXTRA_CONFIGURE_ARGS --with-apxs2
20+
##</autogenerated>##
1621

1722
RUN gpg --keyserver pgp.mit.edu --recv-keys 6E4F6AB321FDC07F2C332E3AC2BF0BC433CFC8B3 0BD78B5F97500D450838F95DFE857D9A90D90EC1
1823

1924
ENV PHP_VERSION 5.6.2
2025

21-
RUN set -x \
22-
&& curl -SLO http://launchpadlibrarian.net/140087283/libbison-dev_2.7.1.dfsg-1_amd64.deb \
23-
&& curl -SLO http://launchpadlibrarian.net/140087282/bison_2.7.1.dfsg-1_amd64.deb \
24-
&& dpkg -i libbison-dev_2.7.1.dfsg-1_amd64.deb \
25-
&& dpkg -i bison_2.7.1.dfsg-1_amd64.deb \
26-
&& rm *.deb \
26+
RUN buildDeps=" \
27+
$PHP_EXTRA_BUILD_DEPS \
28+
build-essential \
29+
bzip2 \
30+
file \
31+
libcurl4-openssl-dev \
32+
libpng12-dev \
33+
libreadline6-dev \
34+
libssl-dev \
35+
libxml2-dev \
36+
m4 \
37+
pkg-config \
38+
"; \
39+
set -x \
40+
&& apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \
2741
&& curl -SL "http://php.net/get/php-$PHP_VERSION.tar.bz2/from/this/mirror" -o php.tar.bz2 \
2842
&& curl -SL "http://php.net/get/php-$PHP_VERSION.tar.bz2.asc/from/this/mirror" -o php.tar.bz2.asc \
2943
&& gpg --verify php.tar.bz2.asc \
@@ -32,20 +46,24 @@ RUN set -x \
3246
&& rm php.tar.bz2* \
3347
&& cd /usr/src/php \
3448
&& ./configure --disable-cgi \
35-
$(command -v apxs2 > /dev/null 2>&1 && echo '--with-apxs2' || true) \
49+
$PHP_EXTRA_CONFIGURE_ARGS \
3650
--with-curl \
3751
--with-gd \
3852
--with-mysql \
3953
--with-mysqli \
4054
--with-openssl \
4155
--with-pdo-mysql \
56+
--with-readline \
4257
--with-zlib \
4358
&& make -j"$(nproc)" \
4459
&& make install \
45-
&& dpkg -r bison libbison-dev \
60+
&& { find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; } \
61+
&& apt-get purge -y --auto-remove $buildDeps \
4662
&& rm -r /usr/src/php
4763

64+
##<autogenerated>##
4865
WORKDIR /var/www/html
4966

5067
EXPOSE 80
5168
CMD ["apache2", "-DFOREGROUND"]
69+
##</autogenerated>##

‎apache-Dockerfile-block-1

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
RUN apt-get update && apt-get install -y apache2-bin apache2.2-common --no-install-recommends && rm -rf /var/lib/apt/lists/*
2+
3+
RUN rm -rf /var/www/html && mkdir -p /var/lock/apache2 /var/run/apache2 /var/log/apache2 /var/www/html && chown -R www-data:www-data /var/lock/apache2 /var/run/apache2 /var/log/apache2 /var/www/html
4+
5+
# Apache + PHP requires preforking Apache for best results
6+
RUN a2dismod mpm_event && a2enmod mpm_prefork
7+
8+
RUN mv /etc/apache2/apache2.conf /etc/apache2/apache2.conf.dist
9+
COPY apache2.conf /etc/apache2/apache2.conf
10+
# it'd be nice if we could not COPY apache2.conf until the end of the Dockerfile, but its contents are checked by PHP during compilation
11+
12+
ENV PHP_EXTRA_BUILD_DEPS apache2-dev
13+
ENV PHP_EXTRA_CONFIGURE_ARGS --with-apxs2

‎apache-Dockerfile-block-2

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
WORKDIR /var/www/html
2+
3+
EXPOSE 80
4+
CMD ["apache2", "-DFOREGROUND"]

‎update.sh

+10-18
Original file line numberDiff line numberDiff line change
@@ -31,24 +31,16 @@ for version in "${versions[@]}"; do
3131
exit 1
3232
fi
3333

34-
awk '$1 != "CMD" { print } $1 == "##<apache2>##" && c == 0 { c = 1; system("cat") }' "$version/Dockerfile" > "$version/apache/Dockerfile" <<-'EOD'
35-
RUN apt-get update && apt-get install -y apache2-bin apache2-dev apache2.2-common --no-install-recommends && rm -rf /var/lib/apt/lists/*
36-
37-
RUN rm -rf /var/www/html && mkdir -p /var/lock/apache2 /var/run/apache2 /var/log/apache2 /var/www/html && chown -R www-data:www-data /var/lock/apache2 /var/run/apache2 /var/log/apache2 /var/www/html
38-
39-
# Apache + PHP requires preforking Apache for best results
40-
RUN a2dismod mpm_event && a2enmod mpm_prefork
41-
42-
RUN mv /etc/apache2/apache2.conf /etc/apache2/apache2.conf.dist
43-
COPY apache2.conf /etc/apache2/apache2.conf
44-
EOD
45-
46-
cat >> "$version/apache/Dockerfile" <<-'EOD'
47-
WORKDIR /var/www/html
48-
49-
EXPOSE 80
50-
CMD ["apache2", "-DFOREGROUND"]
51-
EOD
34+
for variant in apache; do
35+
echo "Generating $version/$variant/Dockerfile from $variant-Dockerfile-block-*"
36+
awk '
37+
$1 == "##</autogenerated>##" { ia = 0 }
38+
!ia { print }
39+
$1 == "##<autogenerated>##" { ia = 1; ab++; ac = 0 }
40+
ia { ac++ }
41+
ia && ac == 1 { system("cat '$variant'-Dockerfile-block-" ab) }
42+
' "$version/Dockerfile" > "$version/$variant/Dockerfile"
43+
done
5244

5345
(
5446
set -x

0 commit comments

Comments
 (0)
Please sign in to comment.