Commit f7521876 authored by Seblu's avatar Seblu
Browse files

Build different release stage of dokuwiki

parent 5b70b3e4
Loading
Loading
Loading
Loading
Loading
+9 −12
Original line number Diff line number Diff line
stages:
 - build
 - release
 - push

docker_build:
  stage: build
  script:
    - version=$(sed -rn 's,ENV DOKUWIKI_VERSION (.*),\1,p' Dockerfile)
    - name=docker.seblu.net/docker/dokuwiki:$version
    - docker build --no-cache --pull --tag "$name" .
  script: BUILD_EXTRA="--no-cache --pull" ./build.sh $CI_REGISTRY_IMAGE

  docker_push:
  stage: release
  stage: push
  before_script:
    - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
  script:
    - version=$(sed -rn 's,ENV DOKUWIKI_VERSION (.*),\1,p' Dockerfile)
    - name=docker.seblu.net/docker/dokuwiki:$version
    - docker push "$name"
    - docker tag "$name" "${name%:*}:latest"
    - docker push "${name%:*}:latest"
    - docker push ${CI_REGISTRY_IMAGE}:oldstable
    - docker push ${CI_REGISTRY_IMAGE}:stable
    - docker push ${CI_REGISTRY_IMAGE}:rc
    - docker push ${CI_REGISTRY_IMAGE}:dev
    - docker push ${CI_REGISTRY_IMAGE}:latest
  only:
    refs:
      - master
+2 −2
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@ FROM php:7-apache

MAINTAINER Sébastien Luttringer <seblu@seblu.net>

ENV DOKUWIKI_VERSION 2018-04-22c
ARG DOKUWIKI_URL

RUN apt-get update \
 && apt-get dist-upgrade -y \
@@ -14,7 +14,7 @@ RUN apt-get update \
 && a2enmod rewrite \
 && sed -i 's/^ServerSignature .*/ServerSignature Off/' /etc/apache2/conf-available/security.conf \
 && sed -i 's/^ServerTokens .*/ServerTokens Minimal/' /etc/apache2/conf-available/security.conf \
 && curl -sL https://github.com/splitbrain/dokuwiki/archive/release_stable_$DOKUWIKI_VERSION.tar.gz \
 && curl -sL $DOKUWIKI_URL \
    | tar xz -C /var/www/html --strip-components=1 \
 && cp /var/www/html/.htaccess.dist /var/www/html/conf/apache.conf \
 && ln -s conf/apache.conf /var/www/html/.htaccess \
+21 −6
Original line number Diff line number Diff line
#!/bin/bash

version=$(sed -rn 's,ENV DOKUWIKI_VERSION (.*),\1,p' Dockerfile)
name=docker.seblu.net/docker/dokuwiki:$version
declare -A versions=(
  ["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"
)

docker build -t "$name" .
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 .
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 =========================================================================
echo ::: IMAGE NOT PUSHED
echo ::: to push image:
echo       docker push "$name"
echo ::: to push as the latest
echo       docker tag "$name" "${name%:*}:latest"
for version in "${!versions[@]}"; do
  echo       docker push "$name:$version"
done
echo       docker push "${name%:*}:latest"
echo =========================================================================