Commit 338bbde7 authored by Seblu's avatar Seblu
Browse files

Build only available versions

- Do not try to build missing tarballs
- Tag latest either stable or rc
parent 34e10e15
Loading
Loading
Loading
Loading
+21 −13
Original line number Diff line number Diff line
#!/bin/bash

declare -A versions=(
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"
  ["rc"]="https://download.dokuwiki.org/src/dokuwiki/dokuwiki-rc.tgz"
  ["stable"]="https://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz"
  ["oldstable"]="https://download.dokuwiki.org/src/dokuwiki/dokuwiki-oldstable.tgz"
  ["stable"]="https://download.dokuwiki.org/src/dokuwiki/dokuwiki-stable.tgz"
  ["rc"]="https://download.dokuwiki.org/src/dokuwiki/dokuwiki-rc.tgz"
)

declare -r name=${1:-docker.seblu.net/docker/dokuwiki}

for version in "${!versions[@]}"; do
  url=${versions[$version]}
  echo "Building $version at $url"
  docker build --build-arg=DOKUWIKI_URL="$url" --tag "$name:$version" $BUILD_EXTRA .
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
done

# latest is always rc, because dokuwiki upstream consider last install should
# be the rc one. The update_check is always looking for RC too.
# https://forum.dokuwiki.org/d/8939-update-check-should-not-be-used-for-release-candidates
docker tag $name:rc $name:latest
echo "Tag latest: $latest"
docker tag $name:$latest $name:latest

echo =========================================================================
echo ::: IMAGE NOT PUSHED