Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 32 additions & 32 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,46 @@ language: bash
services: docker

env:
- VERSION=7.2-rc VARIANT=
- VERSION=7.2-rc VARIANT=alpine
- VERSION=7.2-rc VARIANT=apache
- VERSION=7.2-rc VARIANT=fpm
- VERSION=7.2-rc VARIANT=fpm/alpine
- VERSION=7.2-rc VARIANT=zts
- VERSION=7.2-rc VARIANT=zts/alpine
- VERSION=7.1 VARIANT=
- VERSION=7.1 VARIANT=alpine
- VERSION=7.1 VARIANT=apache
- VERSION=7.1 VARIANT=fpm
- VERSION=7.1 VARIANT=fpm/alpine
- VERSION=7.1 VARIANT=zts
- VERSION=7.1 VARIANT=zts/alpine
- VERSION=7.0 VARIANT=
- VERSION=7.0 VARIANT=alpine
- VERSION=7.0 VARIANT=apache
- VERSION=7.0 VARIANT=fpm
- VERSION=7.0 VARIANT=fpm/alpine
- VERSION=7.0 VARIANT=zts
- VERSION=7.0 VARIANT=zts/alpine
- VERSION=5.6 VARIANT=
- VERSION=5.6 VARIANT=alpine
- VERSION=5.6 VARIANT=apache
- VERSION=5.6 VARIANT=fpm
- VERSION=5.6 VARIANT=fpm/alpine
- VERSION=5.6 VARIANT=zts
- VERSION=5.6 VARIANT=zts/alpine
- VERSION=7.2-rc VARIANT=stretch/cli
- VERSION=7.2-rc VARIANT=stretch/apache
- VERSION=7.2-rc VARIANT=stretch/fpm
- VERSION=7.2-rc VARIANT=stretch/zts
- VERSION=7.2-rc VARIANT=alpine3.6/cli
- VERSION=7.2-rc VARIANT=alpine3.6/fpm
- VERSION=7.2-rc VARIANT=alpine3.6/zts
- VERSION=7.1 VARIANT=jessie/cli
- VERSION=7.1 VARIANT=jessie/apache
- VERSION=7.1 VARIANT=jessie/fpm
- VERSION=7.1 VARIANT=jessie/zts
- VERSION=7.1 VARIANT=alpine3.4/cli
- VERSION=7.1 VARIANT=alpine3.4/fpm
- VERSION=7.1 VARIANT=alpine3.4/zts
- VERSION=7.0 VARIANT=jessie/cli
- VERSION=7.0 VARIANT=jessie/apache
- VERSION=7.0 VARIANT=jessie/fpm
- VERSION=7.0 VARIANT=jessie/zts
- VERSION=7.0 VARIANT=alpine3.4/cli
- VERSION=7.0 VARIANT=alpine3.4/fpm
- VERSION=7.0 VARIANT=alpine3.4/zts
- VERSION=5.6 VARIANT=jessie/cli
- VERSION=5.6 VARIANT=jessie/apache
- VERSION=5.6 VARIANT=jessie/fpm
- VERSION=5.6 VARIANT=jessie/zts
- VERSION=5.6 VARIANT=alpine3.4/cli
- VERSION=5.6 VARIANT=alpine3.4/fpm
- VERSION=5.6 VARIANT=alpine3.4/zts

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

before_script:
- env | sort
- cd "$VERSION"
- image="php:${VERSION}${VARIANT:+-$VARIANT}"
- image="${image//'/'/-}"
- cd "$VERSION/$VARIANT"
- SUBVARIANT="${VARIANT#*/}"
- image="php:${VERSION}-${SUBVARIANT}-${VARIANT%/*}"

script:
- travis_retry docker build -t "$image" "${VARIANT:-.}"
- travis_retry docker build -t "$image" .
- ~/official-images/test/run.sh "$image"

after_script:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
103 changes: 65 additions & 38 deletions generate-stackbrew-library.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
#!/bin/bash
set -eu

defaultDebianSuite='stretch'
declare -A debianSuite=(
[5.6]='jessie'
[7.0]='jessie'
[7.1]='jessie'
)
defaultAlpineVersion='3.6'
declare -A alpineVersion=(
[5.6]='3.4'
[7.0]='3.4'
[7.1]='3.4'
)

declare -A aliases=(
[5.6]='5'
[7.1]='7 latest'
Expand Down Expand Up @@ -70,50 +83,64 @@ join() {
}

for version in "${versions[@]}"; do
commit="$(dirCommit "$version")"

fullVersion="$(git show "$commit":"$version/Dockerfile" | awk '$1 == "ENV" && $2 == "PHP_VERSION" { print $3; exit }')"

versionAliases=(
$fullVersion
$version
${aliases[$version]:-}
)

for variant in \
'' \
alpine \
apache \
fpm fpm/alpine \
zts zts/alpine \
# order here controls the order of the library/ file
for suite in \
stretch \
jessie \
alpine3.6 \
alpine3.4 \
; do
dir="$version${variant:+/$variant}"
[ -f "$dir/Dockerfile" ] || continue
variant="${variant:-cli}"

commit="$(dirCommit "$dir")"

slash='/'
variantAliases=( "${versionAliases[@]/%/-${variant//$slash/-}}" )
variantAliases=( "${variantAliases[@]//latest-/}" )
if [ "$variant" = 'cli' ]; then
variantAliases+=( "${versionAliases[@]}" )
fi

variantParent="$(awk 'toupper($1) == "FROM" { print $2 }' "$dir/Dockerfile")"
variantArches="${parentRepoToArches[$variantParent]}"

# 7.2 no longer supports s390x
if [[ "$version" = 7.* ]] && [ "$version" != '7.0' ] && [ "$version" != '7.1' ]; then
variantArches="$(echo " $variantArches " | sed -r -e 's/ s390x//g')"
fi

echo
cat <<-EOE
Tags: $(join ', ' "${variantAliases[@]}")
Architectures: $(join ', ' $variantArches)
GitCommit: $commit
Directory: $dir
EOE
for variant in \
cli \
apache \
fpm \
zts \
; do
dir="$version/$suite/$variant"
[ -f "$dir/Dockerfile" ] || continue

commit="$(dirCommit "$dir")"
versionSuite="${debianSuite[$version]:-$defaultDebianSuite}"
fullVersion="$(git show "$commit":"$dir/Dockerfile" | awk '$1 == "ENV" && $2 == "PHP_VERSION" { print $3; exit }')"

baseAliases=( $fullVersion "${versionAliases[@]}" )
variantAliases=( "${baseAliases[@]/%/-$variant}" )
variantAliases=( "${variantAliases[@]//latest-/}" )

if [ "$variant" = 'cli' ]; then
variantAliases+=( "${baseAliases[@]}" )
fi

suiteVariantAliases=( "${variantAliases[@]/%/-$suite}" )
if [ "${suite#alpine}" = "${alpineVersion[$version]:-$defaultAlpineVersion}" ] ; then
variantAliases=( "${variantAliases[@]/%/-alpine}" )
elif [ "$suite" != "$versionSuite" ]; then
variantAliases=()
fi
variantAliases=( "${suiteVariantAliases[@]}" "${variantAliases[@]}" )
variantAliases=( "${variantAliases[@]//latest-/}" )

variantParent="$(awk 'toupper($1) == "FROM" { print $2 }' "$dir/Dockerfile")"
variantArches="${parentRepoToArches[$variantParent]}"

# 7.2 no longer supports s390x
if [[ "$version" = 7.* ]] && [ "$version" != '7.0' ] && [ "$version" != '7.1' ]; then
variantArches="$(echo " $variantArches " | sed -r -e 's/ s390x//g')"
fi

echo
cat <<-EOE
Tags: $(join ', ' "${variantAliases[@]}")
Architectures: $(join ', ' $variantArches)
GitCommit: $commit
Directory: $dir
EOE
done
done
done
104 changes: 39 additions & 65 deletions update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,6 @@ declare -A gpgKeys=(
)
# see https://secure.php.net/downloads.php

defaultDebianSuite='stretch-slim'
declare -A debianSuites=(
[5.6]='jessie'
[7.0]='jessie'
[7.1]='jessie'
)
defaultAlpineVersion='3.6'
declare -A alpineVersions=(
[5.6]='3.4'
[7.0]='3.4'
[7.1]='3.4'
)

cd "$(dirname "$(readlink -f "$BASH_SOURCE")")"

versions=( "$@" )
Expand Down Expand Up @@ -131,55 +118,48 @@ for version in "${versions[@]}"; do

dockerfiles=()

{ generated_warning; cat Dockerfile-debian.template; } > "$version/Dockerfile"
cp -v \
docker-php-entrypoint \
docker-php-ext-* \
docker-php-source \
"$version/"
dockerfiles+=( "$version/Dockerfile" )

if [ -d "$version/alpine" ]; then
{ generated_warning; cat Dockerfile-alpine.template; } > "$version/alpine/Dockerfile"
cp -v \
docker-php-entrypoint \
docker-php-ext-* \
docker-php-source \
"$version/alpine/"
dockerfiles+=( "$version/alpine/Dockerfile" )
fi
for suite in stretch jessie alpine3.6 alpine3.4; do
[ -d "$version/$suite" ] || continue
alpineVer="${suite#alpine}"

for target in \
apache \
fpm fpm/alpine \
zts zts/alpine \
; do
[ -d "$version/$target" ] || continue
base="$version/Dockerfile"
variant="${target%%/*}"
if [ "$target" != "$variant" ]; then
variantVariant="${target#$variant/}"
[ -d "$version/$variantVariant" ] || continue
base="$version/$variantVariant/Dockerfile"
baseDockerfile=Dockerfile-debian.template
if [ "${suite#alpine}" != "$suite" ]; then
baseDockerfile=Dockerfile-alpine.template
fi
echo "Generating $version/$target/Dockerfile from $base + $variant-Dockerfile-block-*"
awk '
$1 == "##</autogenerated>##" { ia = 0 }
!ia { print }
$1 == "##<autogenerated>##" { ia = 1; ab++; ac = 0 }
ia { ac++ }
ia && ac == 1 { system("cat '$variant'-Dockerfile-block-" ab) }
' "$base" > "$version/$target/Dockerfile"
cp -v \
docker-php-entrypoint \
docker-php-ext-* \
docker-php-source \
"$version/$target/"
dockerfiles+=( "$version/$target/Dockerfile" )
done

debianSuite="${debianSuites[$rcVersion]:-$defaultDebianSuite}"
alpineVersion="${alpineVersions[$rcVersion]:-$defaultAlpineVersion}"
for variant in cli apache fpm zts; do
[ -d "$version/$suite/$variant" ] || continue
{ generated_warning; cat "$baseDockerfile"; } > "$version/$suite/$variant/Dockerfile"
if [ -f "$variant-Dockerfile-block-1" ]; then
echo "Generating $version/$suite/$variant/Dockerfile from $baseDockerfile + $variant-Dockerfile-block-*"
gawk -i inplace '
$1 == "##</autogenerated>##" { ia = 0 }
!ia { print }
$1 == "##<autogenerated>##" { ia = 1; ab++; ac = 0 }
ia { ac++ }
ia && ac == 1 { system("cat '$variant'-Dockerfile-block-" ab) }
' "$version/$suite/$variant/Dockerfile"
fi

cp \
docker-php-entrypoint \
docker-php-ext-* \
docker-php-source \
"$version/$suite/$variant/"

if [ "$alpineVer" = '3.4' ]; then
sed -ri 's!libressl!openssl!g' "$version/$suite/$variant/Dockerfile"
fi

# automatic `-slim` for stretch
# TODO always add slim once jessie is removed
sed -ri \
-e 's!%%DEBIAN_SUITE%%!'"${suite/stretch/stretch-slim}"'!' \
-e 's!%%ALPINE_VERSION%%!'"$alpineVer"'!' \
"$version/$suite/$variant/Dockerfile"
dockerfiles+=( "$version/$suite/$variant/Dockerfile" )
done
done

(
set -x
Expand All @@ -190,15 +170,9 @@ for version in "${versions[@]}"; do
-e 's!%%PHP_ASC_URL%%!'"$ascUrl"'!' \
-e 's!%%PHP_SHA256%%!'"$sha256"'!' \
-e 's!%%PHP_MD5%%!'"$md5"'!' \
-e 's!%%DEBIAN_SUITE%%!'"$debianSuite"'!' \
-e 's!%%ALPINE_VERSION%%!'"$alpineVersion"'!' \
"${dockerfiles[@]}"
)

if [ "$alpineVersion" = '3.4' ]; then
sed -ri 's!libressl!openssl!g' "${dockerfiles[@]}"
fi

# update entrypoint commands
for dockerfile in "${dockerfiles[@]}"; do
cmd="$(awk '$1 == "CMD" { $1 = ""; print }' "$dockerfile" | tail -1 | jq --raw-output '.[0]')"
Expand Down