diff --git a/BUILD.md b/BUILD.md index 631d999..34ceb8e 100644 --- a/BUILD.md +++ b/BUILD.md @@ -65,10 +65,9 @@ Override these arguments to make use of build.geoserver.org nightly releases: * ``--build-arg STABLE_PLUGIN_URL=https://build.geoserver.org/geoserver/${GS_VERSION}/ext-latest/`` * ``--build-arg COMMUNITY_PLUGIN_URL=https://build.geoserver.org/geoserver/${GS_VERSION}/community-latest/`` - Here is a working example for building 2.23.x nightly build:: ``` -docker build \ +docker build --no-cache-filter download,install \ --build-arg WAR_ZIP_URL=https://build.geoserver.org/geoserver/2.23.x/geoserver-2.23.x-latest-war.zip \ --build-arg STABLE_PLUGIN_URL=https://build.geoserver.org/geoserver/2.23.x/ext-latest/ \ --build-arg COMMUNITY_PLUGIN_URL=https://build.geoserver.org/geoserver/2.23.x/community-latest/ \ @@ -100,7 +99,7 @@ The build.geoserver.org output for the ``main`` branch requires the following: Here is a working example for building main branch as 2.24.x build: ``` -docker build \ +docker build --no-cache-filter download,install \ --build-arg WAR_ZIP_URL=https://build.geoserver.org/geoserver/main/geoserver-main-latest-war.zip \ --build-arg STABLE_PLUGIN_URL=https://build.geoserver.org/geoserver/main/ext-latest/ \ --build-arg COMMUNITY_PLUGIN_URL=https://build.geoserver.org/geoserver/main/community-latest/ \ diff --git a/Dockerfile b/Dockerfile index bc91930..33e1fd2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,42 +1,19 @@ -FROM ubuntu:22.04 +FROM ubuntu:22.04 as tomcat -# The GS_VERSION argument could be used like this to overwrite the default: -# docker build --build-arg GS_VERSION=2.23.0 -t geoserver:2.23.0 . -ARG TOMCAT_VERSION=9.0.74 -ARG GS_VERSION=2.23.0 -ARG GS_DATA_PATH=./geoserver_data/ -ARG ADDITIONAL_LIBS_PATH=./additional_libs/ -ARG ADDITIONAL_FONTS_PATH=./additional_fonts/ +ARG TOMCAT_VERSION=9.0.75 ARG CORS_ENABLED=false ARG CORS_ALLOWED_ORIGINS=* ARG CORS_ALLOWED_METHODS=GET,POST,PUT,DELETE,HEAD,OPTIONS ARG CORS_ALLOWED_HEADERS=* -ARG WAR_ZIP_URL=https://downloads.sourceforge.net/project/geoserver/GeoServer/${GS_VERSION}/geoserver-${GS_VERSION}-war.zip -ARG STABLE_PLUGIN_URL=https://downloads.sourceforge.net/project/geoserver/GeoServer/${GS_VERSION}/extensions -ARG COMMUNITY_PLUGIN_URL='' # Environment variables ENV CATALINA_HOME=/opt/apache-tomcat-${TOMCAT_VERSION} -ENV GEOSERVER_VERSION=$GS_VERSION -ENV GEOSERVER_DATA_DIR=/opt/geoserver_data/ -ENV GEOSERVER_REQUIRE_FILE=$GEOSERVER_DATA_DIR/global.xml -ENV GEOSERVER_LIB_DIR=$CATALINA_HOME/webapps/geoserver/WEB-INF/lib/ ENV EXTRA_JAVA_OPTS="-Xms256m -Xmx1g" ENV CORS_ENABLED=$CORS_ENABLED ENV CORS_ALLOWED_ORIGINS=$CORS_ALLOWED_ORIGINS ENV CORS_ALLOWED_METHODS=$CORS_ALLOWED_METHODS ENV CORS_ALLOWED_HEADERS=$CORS_ALLOWED_HEADERS ENV DEBIAN_FRONTEND=noninteractive -ENV INSTALL_EXTENSIONS=false -ENV WAR_ZIP_URL=$WAR_ZIP_URL -ENV STABLE_EXTENSIONS='' -ENV STABLE_PLUGIN_URL=$STABLE_PLUGIN_URL -ENV COMMUNITY_EXTENSIONS='' -ENV COMMUNITY_PLUGIN_URL=$COMMUNITY_PLUGIN_URL -ENV ADDITIONAL_LIBS_DIR=/opt/additional_libs/ -ENV ADDITIONAL_FONTS_DIR=/opt/additional_fonts/ -ENV SKIP_DEMO_DATA=false -ENV ROOT_WEBAPP_REDIRECT=false # see https://docs.geoserver.org/stable/en/user/production/container.html ENV CATALINA_OPTS="\$EXTRA_JAVA_OPTS \ @@ -50,40 +27,99 @@ ENV CATALINA_OPTS="\$EXTRA_JAVA_OPTS \ -Dorg.geotools.coverage.jaiext.enabled=true" # init -RUN apt update && \ - apt -y upgrade && \ - apt install -y --no-install-recommends openssl unzip gdal-bin wget curl openjdk-11-jdk && \ - apt clean && \ - rm -rf /var/cache/apt/* && \ - rm -rf /var/lib/apt/lists/* +RUN < to see the geoserver page, @@ -47,7 +47,7 @@ To use an external folder as your geoserver data directory. ```shell docker run -it -p 80:8080 \ --mount src="/absolute/path/on/host",target=/opt/geoserver_data/,type=bind \ - docker.osgeo.org/geoserver:2.23.0 + docker.osgeo.org/geoserver:2.23.1 ``` An empty data directory will be populated on first use. You can easily update GeoServer while @@ -62,7 +62,7 @@ The environment variable `SKIP_DEMO_DATA` can be set to `true` to create an empt ```shell docker run -it -p 80:8080 \ --env SKIP_DEMO_DATA=true \ - docker.osgeo.org/geoserver:2.23.0 + docker.osgeo.org/geoserver:2.23.1 ``` ## How to issue a redirect from the root ("/") to GeoServer web interface ("/geoserver/web")? @@ -83,7 +83,7 @@ Example installing wps and ysld extensions: ```shell docker run -it -p 80:8080 \ --env INSTALL_EXTENSIONS=true --env STABLE_EXTENSIONS="wps,ysld" \ - docker.osgeo.org/geoserver:2.23.0 + docker.osgeo.org/geoserver:2.23.1 ``` The list of extensions (taken from SourceForge download page): @@ -108,7 +108,7 @@ If you want to add geoserver extensions/libs, place the respective jar files in ```shell docker run -it -p 80:8080 \ --mount src="/dir/with/libs/on/host",target=/opt/additional_libs,type=bind \ - docker.osgeo.org/geoserver:2.23.0 + docker.osgeo.org/geoserver:2.23.1 ``` ## How to add additional fonts to the docker image (e.g. for SLD styling)? @@ -118,7 +118,7 @@ If you want to add custom fonts (the base image only contains 26 fonts) by using ```shell docker run -it -p 80:8080 \ --mount src="/dir/with/fonts/on/host",target=/opt/additional_fonts,type=bind \ - docker.osgeo.org/geoserver:2.23.0 + docker.osgeo.org/geoserver:2.23.1 ``` **Note:** Do not change the target value! diff --git a/RELEASE.md b/RELEASE.md index 28b99a3..e665d1f 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -7,7 +7,7 @@ OSGeo maintains geoserver-docker.osgeo.org repository for publishing. The result Build locally: ```shell -docker build -t geoserver-docker.osgeo.org/geoserver:2.22.0 . +docker build -t geoserver-docker.osgeo.org/geoserver:2.23.1 . ``` Login using with osgeo user id: @@ -19,7 +19,7 @@ docker login geoserver-docker.osgeo.org Push to osgeo repository: ```shell -docker push geoserver-docker.osgeo.org/geoserver:2.22.0 +docker push geoserver-docker.osgeo.org/geoserver:2.23.1 ``` ## How to automate release? @@ -34,7 +34,7 @@ Examples: `./release.sh 2.22.1 build` -`./release.sh 2.22.0 publish` +`./release.sh 2.23.1 publish` `./release.sh 2.22.1 buildandpublish` diff --git a/build/release.sh b/build/release.sh index f80c93a..bbb3fd9 100755 --- a/build/release.sh +++ b/build/release.sh @@ -3,19 +3,28 @@ # error out if any statements fail set -e +MAIN="2.24" + function usage() { - echo "$0 [options] " - echo " version : The released version to build an docker image for (eg: 2.23.1, 2.24-SNAPSHOT)" + echo "$0 []" + echo "" echo " mode : The mode. Choose one of 'build', 'publish' or 'buildandpublish'" + echo " version : The released version to build an docker image for (eg: 2.23.1, ${MAIN}-SNAPSHOT)" + echo " build : Build number (optional)" } -if [ -z $1 ] || [ -z $2 ] || [[ $2 != "build" && $2 != "publish" && $2 != "buildandpublish" ]]; then +if [ -z $1 ] || [ -z $2 ] || [[ $1 != "build" && $1 != "publish" && $1 != "buildandpublish" ]]; then usage exit fi -VERSION=$1 -MAIN="2.24" +VERSION=$2 +if [ -z $3 ]; then + BUILD=$3 +else + BUILD='' +fi + if [[ "${VERSION:0:4}" == "$MAIN" ]]; then # main branch snapshot release BRANCH=main @@ -36,35 +45,40 @@ echo "Release from branch $BRANCH GeoServer $VERSION as $TAG" # Go up one level to the Dockerfile cd ".." -if [[ $2 == *build* ]]; then +if [[ $1 == *build* ]]; then echo "Building GeoServer Docker Image..." if [[ "$VERSION" == *"-SNAPSHOT"* ]]; then echo " nightly build from https://build.geoserver.org/geoserver/$BRANCH" echo if [[ "$BRANCH" == "main" ]]; then echo "docker build --build-arg GS_VERSION=$VERSION -t $TAG ." - docker build \ + docker build --no-cache-filter download,install \ --build-arg WAR_ZIP_URL=https://build.geoserver.org/geoserver/main/geoserver-main-latest-war.zip \ --build-arg STABLE_PLUGIN_URL=https://build.geoserver.org/geoserver/main/ext-latest/ \ --build-arg COMMUNITY_PLUGIN_URL=https://build.geoserver.org/geoserver/main/community-latest/ \ --build-arg GS_VERSION=$VERSION \ + --build-arg GS_BUILD=$BUILD \ -t $TAG . else echo "docker build --build-arg GS_VERSION=$VERSION -t $TAG ." - docker build \ + docker build --no-cache-filter download,install \ --build-arg WAR_ZIP_URL=https://build.geoserver.org/geoserver/$BRANCH/geoserver-$BRANCH-latest-war.zip \ --build-arg STABLE_PLUGIN_URL=https://build.geoserver.org/geoserver/$BRANCH/ext-latest/ \ --build-arg COMMUNITY_PLUGIN_URL=https://build.geoserver.org/geoserver/$BRANCH/community-latest/ \ --build-arg GS_VERSION=$VERSION \ + --build-arg GS_BUILD=$BUILD \ -t $TAG . fi else echo "docker build --build-arg GS_VERSION=$VERSION -t $TAG ." - docker build --build-arg GS_VERSION=$VERSION -t $TAG . + docker build \ + --build-arg GS_VERSION=$VERSION \ + --build-arg GS_BUILD=$BUILD \ + -t $TAG . fi fi -if [[ $2 == *"publish"* ]]; then +if [[ $1 == *"publish"* ]]; then echo "Publishing GeoServer Docker Image..." echo $DOCKERPASSWORD | docker login -u $DOCKERUSER --password-stdin geoserver-docker.osgeo.org echo "docker push $TAG"