Skip to content

Commit

Permalink
Add FPM variants (styled after OwnCloud's script updates for this sam…
Browse files Browse the repository at this point in the history
…e thing)
  • Loading branch information
tianon committed Feb 8, 2016
1 parent e1b4c2b commit 44f7abc
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 19 deletions.
10 changes: 6 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@ language: bash
services: docker

env:
- VERSION=8
- VERSION=7
- VERSION=8 VARIANT=apache
- VERSION=8 VARIANT=fpm
- VERSION=7 VARIANT=apache
- VERSION=7 VARIANT=fpm

install:
- git clone https://github.com/docker-library/official-images.git ~/official-images

before_script:
- env | sort
- cd "$VERSION"
- image="drupal:$VERSION"
- cd "$VERSION/$VARIANT"
- image="drupal:$VERSION-$VARIANT"

script:
- docker build -t "$image" .
Expand Down
File renamed without changes.
20 changes: 20 additions & 0 deletions 7/fpm/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# from https://www.drupal.org/requirements/php#drupalversions
FROM php:5.6-fpm

# install the PHP extensions we need
RUN apt-get update && apt-get install -y libpng12-dev libjpeg-dev libpq-dev \
&& rm -rf /var/lib/apt/lists/* \
&& docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr \
&& docker-php-ext-install gd mbstring pdo pdo_mysql pdo_pgsql zip

WORKDIR /var/www/html

# https://www.drupal.org/node/3060/release
ENV DRUPAL_VERSION 7.42
ENV DRUPAL_MD5 9a96f67474e209dd48750ba6fccc77db

RUN curl -fSL "http://ftp.drupal.org/files/projects/drupal-${DRUPAL_VERSION}.tar.gz" -o drupal.tar.gz \
&& echo "${DRUPAL_MD5} *drupal.tar.gz" | md5sum -c - \
&& tar -xz --strip-components=1 -f drupal.tar.gz \
&& rm drupal.tar.gz \
&& chown -R www-data:www-data sites
File renamed without changes.
31 changes: 31 additions & 0 deletions 8/fpm/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# from https://www.drupal.org/requirements/php#drupalversions
FROM php:5.6-fpm

# install the PHP extensions we need
RUN apt-get update && apt-get install -y libpng12-dev libjpeg-dev libpq-dev \
&& rm -rf /var/lib/apt/lists/* \
&& docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr \
&& docker-php-ext-install gd mbstring opcache pdo pdo_mysql pdo_pgsql zip

# set recommended PHP.ini settings
# see https://secure.php.net/manual/en/opcache.installation.php
RUN { \
echo 'opcache.memory_consumption=128'; \
echo 'opcache.interned_strings_buffer=8'; \
echo 'opcache.max_accelerated_files=4000'; \
echo 'opcache.revalidate_freq=60'; \
echo 'opcache.fast_shutdown=1'; \
echo 'opcache.enable_cli=1'; \
} > /usr/local/etc/php/conf.d/opcache-recommended.ini

WORKDIR /var/www/html

# https://www.drupal.org/node/3060/release
ENV DRUPAL_VERSION 8.0.3
ENV DRUPAL_MD5 7d5f5278a870b8f4a29cda4fe915d619

RUN curl -fSL "http://ftp.drupal.org/files/projects/drupal-${DRUPAL_VERSION}.tar.gz" -o drupal.tar.gz \
&& echo "${DRUPAL_MD5} *drupal.tar.gz" | md5sum -c - \
&& tar -xz --strip-components=1 -f drupal.tar.gz \
&& rm drupal.tar.gz \
&& chown -R www-data:www-data sites
35 changes: 22 additions & 13 deletions generate-stackbrew-library.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,27 @@ url='git://github.com/docker-library/drupal'
echo '# maintainer: InfoSiftr <[email protected]> (@infosiftr)'

for version in "${versions[@]}"; do
commit="$(cd "$version" && git log -1 --format='format:%H' -- Dockerfile $(awk 'toupper($1) == "COPY" { for (i = 2; i < NF; i++) { print $i } }' Dockerfile))"
fullVersion="$(grep -m1 'ENV DRUPAL_VERSION' "$version/Dockerfile" | cut -d' ' -f3)"

versionAliases=()
while [ "$fullVersion" != "$version" -a "${fullVersion%[.-]*}" != "$fullVersion" ]; do
versionAliases+=( $fullVersion )
fullVersion="${fullVersion%[.-]*}"
done
versionAliases+=( $version ${aliases[$version]} )

echo
for va in "${versionAliases[@]}"; do
echo "$va: ${url}@${commit} $version"
for variant in apache fpm; do
commit="$(cd "$version/$variant" && git log -1 --format='format:%H' -- Dockerfile $(awk 'toupper($1) == "COPY" { for (i = 2; i < NF; i++) { print $i } }' Dockerfile))"
fullVersion="$(grep -m1 'ENV DRUPAL_VERSION ' "$version/$variant/Dockerfile" | cut -d' ' -f3)"

versionAliases=()
while [ "$fullVersion" != "$version" -a "${fullVersion%[.-]*}" != "$fullVersion" ]; do
versionAliases+=( $fullVersion )
fullVersion="${fullVersion%[.-]*}"
done
versionAliases+=( $version ${aliases[$version]} )

echo
for va in "${versionAliases[@]}"; do
if [ "$va" = 'latest' ]; then
echo "$variant: ${url}@${commit} $version/$variant"
else
echo "$va-$variant: ${url}@${commit} $version/$variant"
fi
if [ "$variant" = 'apache' ]; then
echo "$va: ${url}@${commit} $version/$variant"
fi
done
done
done
6 changes: 4 additions & 2 deletions update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ for version in "${versions[@]}"; do
sed -ri '
s/^(ENV DRUPAL_VERSION) .*/\1 '"$fullVersion"'/;
s/^(ENV DRUPAL_MD5) .*/\1 '"$md5"'/;
' "$version/Dockerfile"
' "$version"/*/Dockerfile
)

travisEnv='\n - VERSION='"$version$travisEnv"
for variant in fpm apache; do
travisEnv='\n - VERSION='"$version"' VARIANT='"$variant$travisEnv"
done
done

travis="$(awk -v 'RS=\n\n' '$1 == "env:" { $0 = "env:'"$travisEnv"'" } { printf "%s%s", $0, RS }' .travis.yml)"
Expand Down

0 comments on commit 44f7abc

Please sign in to comment.