From dd09ec74865b3f356112f84ef66a64327e90f7dc Mon Sep 17 00:00:00 2001 From: Johannes Weskamm Date: Wed, 1 Feb 2023 11:31:24 +0100 Subject: [PATCH 1/3] Adding build and release script --- build/release.sh | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 build/release.sh diff --git a/build/release.sh b/build/release.sh new file mode 100755 index 0000000..6d9814c --- /dev/null +++ b/build/release.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +# error out if any statements fail +set -e + +function usage() { + echo "$0 [options] " + echo " version : The released version to build an docker image for (eg: 2.1.4)" + echo " mode : The mode. Choose one of 'build', 'publish' or 'buildandpublish'" +} + +if [ -z $1 ] || [ -z $2 ] || [[ $2 != "build" && $2 != "publish" && $2 != "buildandpublish" ]]; then + usage + exit +fi + +VERSION=$1 +TAG=geoserver-docker.osgeo.org/geoserver:$VERSION + +# Go up one level to the Dockerfile +cd ".." + +if [ $2 != "publish" ]; then + echo "Building GeoServer Docker Image..." + echo "docker build --build-arg GS_VERSION=$VERSION -t $TAG ." + docker build --build-arg GS_VERSION=$VERSION -t $TAG . +fi + +if [ $2 != "build" ]; then + echo "Publishing GeoServer Docker Image..." + echo $DOCKERPASSWORD | docker login -u $DOCKERUSER --password-stdin geoserver-docker.osgeo.org + echo "docker push $TAG" + docker push $TAG +fi From 15db31a51e563861a85d38231f2567e53dc97aac Mon Sep 17 00:00:00 2001 From: Johannes Weskamm Date: Wed, 1 Feb 2023 13:18:01 +0100 Subject: [PATCH 2/3] Add release script usage to readme --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.md b/README.md index 2f1be04..484c260 100644 --- a/README.md +++ b/README.md @@ -225,3 +225,19 @@ Push to osgeo repository: ```shell docker push geoserver-docker.osgeo.org/geoserver:2.21.1 ``` + +### How to automate release? + +For CI purposes, the script in the `build` folder is used to simplify those steps. + +The variables `DOCKERUSER` and `DOCKERPASSWORD` have to be set with valid credentials before this script can push the image to the osgeo repo. + +You need to pass the version as first and the type as second argument, where type has to be one of `build`, `publish` or `buildandpublish`. + +Examples: + +`./release.sh 2.22.1 build` + +`./release.sh 2.22.0 publish` + +`./release.sh 2.22.1 buildandpublish` From b1a50a0b7d7d8688edeb62a68286fef38c3debce Mon Sep 17 00:00:00 2001 From: Johannes Weskamm Date: Wed, 1 Feb 2023 13:22:16 +0100 Subject: [PATCH 3/3] Add dockerignore file --- .dockerignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..567609b --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +build/