Skip to content
build.sh 1.53 KiB
Newer Older
Seblu's avatar
Seblu committed
#!/bin/bash

Seblu's avatar
Seblu committed
set -e

Seblu's avatar
Seblu committed
declare -r name=${1:-docker.seblu.net/docker/dokuwiki}
# Dokuwiki upstream consider the last reliable version to be rc when available.
# The update_check in dokuwiki is always looking for RC too.
# https://forum.dokuwiki.org/d/8939-update-check-should-not-be-used-for-release-candidates
# so we tag latest rc when available, either stable or oldstable.
declare latest=''

# declare well known versions. order matter!
declare -a versions=(dev oldstable stable rc)
declare -A url=(
  ["dev"]="http://github.com/splitbrain/dokuwiki/tarball/master"
  ["oldstable"]="https://download.dokuwiki.org/src/dokuwiki/dokuwiki-oldstable.tgz"
Seblu's avatar
Seblu committed
  ["stable"]="https://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz"
  ["rc"]="https://download.dokuwiki.org/src/dokuwiki/dokuwiki-rc.tgz"
Seblu's avatar
Seblu committed

Seblu's avatar
Seblu committed
for version in "${versions[@]}"; do
  # do not build unavailable url (e.g: rc is only avaible before a new release)
  echo "Checking $version url ${url[$version]}"
  curl -Isf "${url[$version]}" -o /dev/null || continue
  echo "Building $version"
  docker build --build-arg=DOKUWIKI_URL="${url[$version]}" --tag "$name:$version" $BUILD_EXTRA .
  latest=$version
Seblu's avatar
Seblu committed
echo "Tag latest: $latest"
docker tag $name:$latest $name:latest
Seblu's avatar
Seblu committed

echo =========================================================================
echo ::: IMAGE NOT PUSHED
echo ::: to push image:
for version in "${!versions[@]}"; do
  echo       docker push "$name:$version"
done
Seblu's avatar
Seblu committed
echo       docker push "${name%:*}:latest"
echo =========================================================================