diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 813fca8..ce4a285 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -3,16 +3,10 @@ on:
push:
branches:
- "master"
+ - "upgrade-geoserver-2.28.x-testing-branch"
jobs:
build-and-push-image:
runs-on: ubuntu-latest
- strategy:
- fail-fast: false
- matrix:
- include:
- - tag: 2.26.0-jms # 2.22.1
- gs-version: 2.26.0
- label: 2.26.0-jms
permissions:
contents: read
packages: write
@@ -27,10 +21,63 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
+ - name: Load build config
+ id: cfg
+ shell: bash
+ run: |
+ set -euo pipefail
+ CONFIG_FILE="build/build-config.yml"
+
+ cfg_get() {
+ local key="$1"
+ local value
+ value=$(grep -E "^${key}:" "$CONFIG_FILE" | head -n 1 | sed -E "s/^${key}:[[:space:]]*//")
+ value=${value//\"/}
+ value=${value//\'/}
+ echo "$value"
+ }
+
+ cfg_get_optional() {
+ local key="$1"
+ local value
+ value=$(grep -E "^${key}:" "$CONFIG_FILE" | head -n 1 | sed -E "s/^${key}:[[:space:]]*//" || true)
+ value=${value//\"/}
+ value=${value//\'/}
+ echo "$value"
+ }
+
+ GS_VERSION="$(cfg_get gs_version)"
+ TOMCAT_IMAGE="$(cfg_get tomcat_image)"
+ GDAL_VERSION="$(cfg_get gdal_version)"
+ GDAL_NATIVE="$(cfg_get gdal_native)"
+ TOMCAT_EXTRAS="$(cfg_get tomcat_extras)"
+ BUILD_PLATFORM="$(cfg_get build_platform)"
+ DOCKER_IMAGE="$(cfg_get docker_image)"
+ DOCKER_TAG="$(cfg_get_optional docker_tag)"
+ DOCKER_LABEL="$(cfg_get_optional docker_label)"
+
+ ARCH="$(echo "$BUILD_PLATFORM" | cut -d'/' -f2)"
+ if [ -z "$DOCKER_TAG" ] || [ "$DOCKER_TAG" = "auto" ]
+ then
+ TAG="${GS_VERSION}-${ARCH}"
+ else
+ TAG="$DOCKER_TAG"
+ fi
+
+ echo "gs_version=${GS_VERSION}" >> "$GITHUB_OUTPUT"
+ echo "tomcat_image=${TOMCAT_IMAGE}" >> "$GITHUB_OUTPUT"
+ echo "gdal_version=${GDAL_VERSION}" >> "$GITHUB_OUTPUT"
+ echo "gdal_native=${GDAL_NATIVE}" >> "$GITHUB_OUTPUT"
+ echo "tomcat_extras=${TOMCAT_EXTRAS}" >> "$GITHUB_OUTPUT"
+ echo "build_platform=${BUILD_PLATFORM}" >> "$GITHUB_OUTPUT"
+ echo "docker_image=${DOCKER_IMAGE}" >> "$GITHUB_OUTPUT"
+ echo "docker_label=${DOCKER_LABEL}" >> "$GITHUB_OUTPUT"
+ echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
+
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
- platforms: linux/arm64/v8
+ platforms: ${{ steps.cfg.outputs.build_platform }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
@@ -39,14 +86,14 @@ jobs:
id: meta
uses: docker/metadata-action@v4
with:
- images: thinkwhere/geoserver
- tags: ${{ matrix.tag }}
+ images: ${{ steps.cfg.outputs.docker_image }}
+ tags: ${{ steps.cfg.outputs.tag }}
- name: Download build files
run: |
cd build
chmod +x ./download.sh
- sudo ./download.sh "${{ matrix.gs-version }}"
+ sudo ./download.sh "${{ steps.cfg.outputs.gs_version }}"
- name: Build and push application-base
uses: docker/build-push-action@v4
@@ -54,8 +101,14 @@ jobs:
context: ./build
file: ./build/Dockerfile
build-args: |
- GS_VERSION=${{ matrix.gs-version }}
+ GS_VERSION=${{ steps.cfg.outputs.gs_version }}
+ TOMCAT_IMAGE=${{ steps.cfg.outputs.tomcat_image }}
+ GDAL_VERSION=${{ steps.cfg.outputs.gdal_version }}
+ GDAL_NATIVE=${{ steps.cfg.outputs.gdal_native }}
+ TOMCAT_EXTRAS=${{ steps.cfg.outputs.tomcat_extras }}
push: true
tags: ${{ steps.meta.outputs.tags }}
- platforms: linux/arm64/v8
- labels: ${{ steps.meta.outputs.labels }}
+ platforms: ${{ steps.cfg.outputs.build_platform }}
+ labels: |
+ ${{ steps.meta.outputs.labels }}
+ ${{ steps.cfg.outputs.docker_label }}
diff --git a/README.md b/README.md
index 06fa0c4..82ae007 100644
--- a/README.md
+++ b/README.md
@@ -1,230 +1,139 @@
# docker-geoserver
-A simple docker container that runs Geoserver influenced by this docker
-recipe: https://github.com/kartoza/docker-geoserver by Tim Sutton. Created with input from GeoSolutions.
+Container image build for thinkWhere GeoServer deployments.
-This container is configured to build with:
-* Tomcat9
-* Openjdk 11
-* GeoServer 2.8.x +
-* GeoServer Plugins: Any plugins downloaded to /resources/plugins folder will be included in the container
-* Truetype fonts: Any .ttf fonts copied to the /resources/fonts folder will be included in the container
+This repository now uses a config-driven build flow so version and plugin updates are made in one place.
+## What this repo builds
-**Note:** We recommend using ``apt-cacher-ng`` to speed up package fetching -
-you should configure the host for it in the provided 71-apt-cacher-ng file.
+The image is built from:
-## Getting Started
+- Tomcat base image (configurable)
+- GeoServer WAR (configurable version)
+- Stable and community GeoServer plugins (configurable lists)
+- Optional GDAL native support and GDAL GeoServer extension
+- Optional custom fonts from `build/resources/fonts`
-The image can be downloaded from our image on dockerhub. There are tagged images for most versions that have been released since 2.8:
+Main build files:
-```shell
-docker pull thinkwhere/geoserver
-```
-
-To build the image yourself:
-
-```shell
-docker build -t thinkwhere/geoserver git://github.com/thinkwhere/geoserver-docker/build
-```
-
-Or for more control over the contents of the image, clone the repository first. This way you can specify the version to build, and choose which fonts and plugins to include
-
-
-```shell
-git clone git://github.com/thinkwhere/geoserver-docker
-
-cd geoserver/build
-
-docker build --build-arg GS_VERSION=2.18.2 -t mygeoserver .
-```
-
-### Build scripts
-
-For convenience, there is a `build.bat` and `build.sh` for running the build.
-- Edit these with the GeoServer version you want to build
-- Edit these to set the plugins variable with the list of plugins to include in the build
-- Run the appropriate build.x file for your environment (build.bat for Docker in Windows; build.sh for Docker in Linux)
-
-
-## Options
-
-### Geoserver Plugins
-
-To build the GeoServer image with plugins (Control Flow, Monitor, Inspire, etc),
-download the plugin zip files from the GeoServer download page and put them in
-`resources/plugins` before building. You should make sure these match the version of
-GeoServer you are installing.
-GeoServer version is controlled by the variable in Dockerfile or the build script, or download the WAR bundle
-for the version you want to `resources/geoserver.zip` before building.
-
-### Community Plugins
-
-Community plugins are also available (S3 Geotiff) and can be added by placing the appropraite zip file(s) in the same location.
-They are not available from the SourceForge source used in the build scripts, so additional scripting has been
-included to source them from [GeoSever](https://build.geoserver.org/). Make sure that these lines are included and the list of
-plugins includes the plugin(s) required.
-### Custom Fonts
+- `build/build-config.yml` (single source of build values)
+- `build/build.sh` (Linux/macOS local build)
+- `build/build.bat` (Windows local build)
+- `build/Dockerfile` (image recipe)
+- `build/download.sh` (plugin download helper used by GitHub Actions)
-To include any .ttf fonts with symbols in your container, copy them into the `resources/fonts` folder
-before building.
+## Central config file
-This repo bundles the following 3rd-party fonts:
+Update only `build/build-config.yml` for normal version/plugin changes.
- * UN OCHA fonts for humanitarian relief mapping (http://reliefweb.int/report/world/world-humanitarian-and-country-icons-2012).
- * Roboto fonts from google (https://github.com/google/roboto/).
- * Liberation Sans fonts from Red Hat (https://www.dafont.com/liberation-sans.font).
+Keys:
+- `gs_version`
+- `tomcat_image`
+- `gdal_version`
+- `gdal_native`
+- `tomcat_extras`
+- `build_platform`
+- `plugins` (comma-separated stable plugins)
+- `community_plugins` (comma-separated community plugins)
-### Tomcat Extras
+ARM64 example values are included as comments in the same file.
-Tomcat is bundled with extras including docs, examples, etc. If you don't need these, set
-the `TOMCAT_EXTRAS` build-arg to `false` when building the image. (This is the default in
-build.sh.)
+## Local build
-```shell
-docker build --build-arg TOMCAT_EXTRAS=false -t thinkwhere/geoserver-docker .
-```
-
-### GeoWebCache
+### Windows
-GeoServer is installed by default with the integrated GeoWebCache functionality. If you are using
-the stand-alone GeoWebCache, or another caching engine such as MapProxy, you can remove the built-in GWC
-by setting the `DISABLE_GWC` build-arg to `true` when building the image.
+1. Open PowerShell.
+2. Go to `build` folder.
+3. Run `build.bat`.
-```shell
-docker build --build-arg DISABLE_GWC=true -t thinkwhere/geoserver-docker .
+```powershell
+Set-Location "C:\data\DATA_TEAM\geoserver_upgrade\generation_of_images\GeoServer-Docker\build"
+.\build.bat
```
-**Note:** this removes all *gwc* jar files from the installation. If you are building with plugins that have
-dependencies on the gwc classes, using this option could prevent geoserver from initializing.
-(examples include: INSPIRE plugin v2.9.2+; control-flow plugin v2.9.2+)
-
-### Native JAI / JAI ImageIO
-
-Native JAI and JAI ImageIO are included in the final image by default providing better
-performance for raster data processing. Unfortunately they native JAI is not under active
-development anymore. In the event that you face issues with raster data processing,
-they can remove them from the final image by setting the `JAI_IMAGEIO` build-arg to `false`
-when building the image.
-
-```shell
-docker build --build-arg JAI_IMAGEIO=false -t thinkwhere/geoserver-docker .
-```
-
-### GDAL Image Formats support
-
-You can optionally include native GDAL libraries and GDAL extension in the image to enable
-support for GDAL image formats.
-
-To include native GDAL libraries in the image, set the `GDAL_NATIVE` build-arg to `true`
-when building the image.
+### Linux/macOS
-```shell
-docker build --build-arg GDAL_NATIVE=true -t thinkwhere/geoserver-docker .
-```
-
-To include the GDAL extension in the final image download the extension and place the zip
-file in the `resources/plugins` folder before building the image. If you use the build.sh
-script to build the image simply uncomment the relevant part of the script.
+1. Open shell.
+2. Go to `build` folder.
+3. Run `build.sh`.
-```shell
-#if [ ! -f resources/plugins/geoserver-gdal-plugin.zip ]
-#then
-# wget -c http://netix.dl.sourceforge.net/project/geoserver/GeoServer/2.8.3/extensions/geoserver-2.8.3-gdal-plugin.zip -O resources/plugins/geoserver-gdal-plugin.zip
-#fi
+```bash
+cd build
+chmod +x build.sh
+./build.sh
```
-### S3 Geotiff plugin
-
-The S3 Geotiff plugin is required to serve GeoTiffs from S3.
-NOTE: that it is a community plugin and therefore not officially supported
-
-This plugin requires that environment variables are set for:
-- AWS_ACCESS_KEY
-- AWS_SECRET_KEY
-
-These are included in the setenv.sh file in tomcat_settings and should be edited to have appropriate values.
+Important:
-See [Setting Tomcat properties](#setting-tomcat-properties) for an example of including this.
+- Both scripts build locally only (`docker build`), they do not push images.
+- If plugin ZIP files already exist in `build/resources/plugins`, scripts skip re-download.
-## Run
+## Run container locally
-### External geoserver_data directory
-You probably want to run Geoserver with an external geoserver_data directory mapped as a docker volume.
-This allows the configuration to be persisted or shared with other instances. To create a running container
-with an external volume do:
+Windows example with repo-local data directory:
-```shell
-mkdir -p ~/geoserver_data
-docker run \
- --name=geoserver \
- -p 8080:8080 \
- -d \
- -v $HOME/geoserver_data:/opt/geoserver/data_dir \
- -t thinkwhere/geoserver
+```powershell
+docker rm -f geoserver_local 2>$null
+docker run --name geoserver_local -p 8085:8080 -d -v "C:\data\DATA_TEAM\geoserver_upgrade\generation_of_images\GeoServer-Docker\build\resources\data_dir:/opt/geoserver/data_dir" -e "GEOSERVER_LOG_LOCATION=/opt/geoserver/data_dir/logs/geoserver_8085.log" thinkwhere/geoserver:2.28.4
```
-### Running multiple instances on the same machine
-For installations with multiple containers on the same host, map port 8080 to a different port for each
-instance. It is recommended that the instance name contains the mapped port no for ease of reference.
-Each instance should also have its own log file, specified by passing in the `GEOSERVER_LOG_LOCATION'
-variable as illustrated in the example below.
-
-```shell
-mkdir -p ~/geoserver_data
-docker run \
- --name=geoserver \
- -p 8085:8080 \
- -d \
- -v $HOME/geoserver_data:/opt/geoserver/data_dir \
- -e "GEOSERVER_LOG_LOCATION=/opt/geoserver/data_dir/logs/geoserver_8085.log" \
- -t thinkwhere/geoserver
-```
+Open:
-### Setting Tomcat properties
+- `http://localhost:8085/geoserver`
-To set Tomcat properties such as maximum heap memory size, create a `setenv.sh`
-file such as:
+## Deprecated files
-```shell
-JAVA_OPTS="$JAVA_OPTS -Xmx1024M"
-JAVA_OPTS="$JAVA_OPTS -Djava.awt.headless=true -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled"
-```
+- `docker-compose.deprecated.yml` is legacy reference only and is not part of the current build/deploy flow.
-Then pass the `setenv.sh` file as a volume at `/usr/local/tomcat/bin/setenv.sh` when running:
+## Nginx config (testing only)
-```shell
-docker run -d \
- -v $HOME/tomcat/setenv.sh:/usr/local/tomcat/bin/setenv.sh \
- thinkwhere/geserver
-```
+- `nginx/nginx-for-testing.conf` is a local/deprecated testing config for a separate `nginx` container.
+- It is not packaged into the `thinkwhere/geoserver` image.
+- The GeoServer image build context is `build/`, so files under `nginx/` are excluded from image builds.
-It is also possible to pass in custom values to Tomcat which are controlled in server.xml, for example `MaxHttpHeaderSize`. A full list of these parameters can be found in `build/tomcat/update_tomcat_settings.sh`
+## Step-by-step: upgrade GeoServer version
-Environemnt variables can be passed in to the `docker run` command, as well as a request to run `update_tomcat_settings.sh` which will pass these values into the Tomcat `server.xml`.
+Use this process when preparing a new image release.
-For example -
+1. Edit `build/build-config.yml`.
+2. Set `gs_version` to the new GeoServer version.
+3. Review `plugins` and `community_plugins` lists and adjust as needed for that version.
+4. If needed, update `tomcat_image`, `gdal_version`, and `gdal_native`.
+5. Run local build (`build.bat` on Windows or `build.sh` on Linux).
+6. Run a local container and verify GeoServer starts and required plugins load.
+7. Commit and push your changes to `master`.
-```shell
-docker run -e "HTTP_MAX_HEADER_SIZE=524288" -t thinkwhere/geoserver:2.18.3 /bin/sh -c conf/update_tomcat_settings.sh
-```
+## Step-by-step: what GitHub Actions does
+Workflow file: `.github/workflows/main.yml`.
-This repository contains a ``run.sh`` script for your convenience.
+On push to `master`, GitHub Actions does this:
-### Using docker-compose
+1. Checks out the repository.
+2. Logs in to Docker Hub using repository secrets:
+ - `DOCKERHUB_USERNAME`
+ - `DOCKERHUB_TOKEN`
+3. Sets up QEMU and Buildx for multi-arch builds.
+4. Runs `build/download.sh ` to fetch plugin ZIP files into `build/resources/plugins`.
+5. Builds the image from `build/Dockerfile` using matrix build args (GeoServer version, Tomcat image, GDAL settings).
+6. Pushes the image to Docker Hub under `thinkwhere/geoserver:`.
-Docker-compose allows you to deploy a load-balanced cluster of geoserver containers with a single command. A sample docker-compose.yml configuration file is included in this repository, along with a sample nginx configuration file.
+## Step-by-step: how to publish a new Docker Hub tag
-To deploy using docker-compose:
+1. Open `.github/workflows/main.yml`.
+2. In the matrix entry, update:
+ - `tag`
+ - `gs-version`
+ - (optional) `tomcat-image`, `gdal-version`, `gdal-native`, `tomcat-extras`, `platform`
+3. Ensure `build/build-config.yml` plugin lists are compatible with that GeoServer version.
+4. Commit and push to `master`.
+5. Watch the workflow run in GitHub Actions.
+6. Confirm the new tag appears on Docker Hub (`thinkwhere/geoserver`).
-1. copy nginx folder from this repository to your machine.
-2. copy tomcat_settings folder from this repository to your machine.
-3. copy docker-compose.yml to your machine. Edit the volume entries to reflect the correct location of your geoserver_data, nginx and tomcat_settings folders on your machine.
-4. type `docker-compose up -d` to start up a load-balanced cluster of 2x geoserver containers + nginx.
-5. access geoserver services at http://localhost/geoserver/wms?
+## Notes
-**Note:** The default geoserver user is 'admin' and the password is 'geoserver'.
-It is recommended that these are changed for production systems.
+- `GDAL_NATIVE=true` installs/copies GDAL native dependencies and ensures GDAL extension ZIP is available during build.
+- `GDAL_NATIVE=false` skips GDAL native setup and skips GDAL extension auto-download.
+- Local scripts and CI both rely on build args and config-driven values to avoid hardcoded updates in multiple places.
diff --git a/RELEASE_GUIDE.md b/RELEASE_GUIDE.md
new file mode 100644
index 0000000..a6d771d
--- /dev/null
+++ b/RELEASE_GUIDE.md
@@ -0,0 +1,184 @@
+# GeoServer Docker Release Playbook
+
+A practical, human-friendly guide for publishing a new `thinkwhere/geoserver` image.
+
+## Release Flow At A Glance
+
+1. Choose the target version and platform.
+2. Update build config.
+3. Build locally.
+4. Run and validate locally.
+5. Update GitHub Actions publish matrix.
+6. Push to `master`.
+7. Confirm Docker Hub tag and smoke test.
+
+---
+
+## 1) Decide What You Are Releasing
+
+Before changing files, agree these values:
+
+- GeoServer version (for example `2.28.4`)
+- Docker Hub tag name (for example `2.28.4-arm64`)
+- Target platform (`linux/amd64` or `linux/arm64/v8`)
+- GDAL enabled or not (`gdal_native: true|false`)
+- Tomcat base image
+
+Quick rule:
+
+- If this is a routine GeoServer patch upgrade, keep Tomcat/GDAL unchanged unless there is a known requirement.
+
+---
+
+## 2) Update Build Configuration
+
+Edit [build/build-config.yml](build/build-config.yml).
+
+Typical keys to review:
+
+- `gs_version`
+- `tomcat_image`
+- `gdal_version`
+- `gdal_native`
+- `tomcat_extras`
+- `build_platform`
+- `plugins`
+- `community_plugins`
+
+Checklist:
+
+- Plugin names are correct for the chosen GeoServer version.
+- `build_platform` matches what you want to test locally first.
+- ARM64 comments are updated if you are preparing an ARM release.
+
+---
+
+## 3) Build Locally First (Required)
+
+### Windows
+
+From [build](build):
+
+```powershell
+.\build.bat
+```
+
+### Linux/macOS
+
+From [build](build):
+
+```bash
+chmod +x build.sh
+./build.sh
+```
+
+Expected behavior:
+
+- Existing plugin ZIP files are skipped.
+- Missing ZIP files are downloaded.
+- Image is built locally only (no push).
+
+---
+
+## 4) Run and Validate Locally
+
+### Windows example using repo-local data dir
+
+```powershell
+docker rm -f geoserver_local 2>$null
+docker run --name geoserver_local -p 8085:8080 -d -v "C:\data\DATA_TEAM\geoserver_upgrade\generation_of_images\GeoServer-Docker\build\resources\data_dir:/opt/geoserver/data_dir" -e "GEOSERVER_LOG_LOCATION=/opt/geoserver/data_dir/logs/geoserver_8085.log" thinkwhere/geoserver:2.28.4
+```
+
+Validation checklist:
+
+- Container is up (`docker ps`).
+- No startup failures in logs (`docker logs -f geoserver_local`).
+- GeoServer UI opens at `http://localhost:8085/geoserver`.
+- Expected plugins are visible/usable.
+- If GDAL is enabled, expected raster workflows function.
+
+---
+
+## 5) Prepare CI Publish Settings
+
+Edit [.github/workflows/main.yml](.github/workflows/main.yml).
+
+In the matrix entry, update:
+
+- `tag`
+- `gs-version`
+- `tomcat-image`
+- `gdal-version`
+- `gdal-native`
+- `tomcat-extras`
+- `platform`
+
+Why this matters:
+
+- CI publish does not read your local shell variables.
+- CI pushes exactly what the workflow matrix says.
+
+---
+
+## 6) Commit and Push
+
+Commit the release changes, then push to `master`.
+
+Typical files changed for a release:
+
+- [build/build-config.yml](build/build-config.yml)
+- [.github/workflows/main.yml](.github/workflows/main.yml)
+- Optional: docs updates
+
+---
+
+## 7) What GitHub Actions Does
+
+On push to `master`, workflow [main.yml](.github/workflows/main.yml) will:
+
+1. Checkout repository.
+2. Login to Docker Hub using secrets.
+3. Setup QEMU/Buildx.
+4. Run [build/download.sh](build/download.sh) to fetch plugin ZIPs.
+5. Build using `build/Dockerfile` with matrix build args.
+6. Push image to Docker Hub with the matrix tag.
+
+---
+
+## 8) Post-Publish Verification
+
+After CI is green:
+
+1. Confirm tag exists on Docker Hub (`thinkwhere/geoserver:`).
+2. Pull that exact tag on a clean machine.
+3. Run a quick smoke test container.
+4. Confirm startup and key plugin behavior.
+
+---
+
+## Troubleshooting Notes
+
+### Build warning about `ARG` in `FROM`
+
+If Docker warns about invalid default arg in `FROM`, but build uses valid args from scripts/workflow, it is usually non-blocking.
+
+### Docker daemon connection errors on Windows
+
+If you see `dockerDesktopLinuxEngine` connection errors, ensure Docker Desktop is running and Linux containers are active.
+
+### Plugin download mismatch
+
+If plugin ZIP names are wrong for a version, update plugin lists in [build/build-config.yml](build/build-config.yml) and rerun local build.
+
+---
+
+## Quick Release Checklist
+
+- [ ] Updated [build/build-config.yml](build/build-config.yml)
+- [ ] Local build passed
+- [ ] Local run passed
+- [ ] Updated matrix in [.github/workflows/main.yml](.github/workflows/main.yml)
+- [ ] Pushed to `master`
+- [ ] GitHub Actions passed
+- [ ] Docker Hub tag verified
+- [ ] Smoke test on published tag passed
diff --git a/build/Dockerfile b/build/Dockerfile
index a96f1c5..2c08358 100644
--- a/build/Dockerfile
+++ b/build/Dockerfile
@@ -1,11 +1,15 @@
#--------- Generic stuff all our Dockerfiles should start with so we get caching ------------
+ARG GDAL_VERSION
+ARG TOMCAT_IMAGE
+FROM ghcr.io/osgeo/gdal:ubuntu-full-${GDAL_VERSION} AS gdal-builder
+
# Defaults to amd64:
-FROM tomcat:9-jre11-temurin@sha256:bf23f2dffde0c1b6ef6eaba95e05f531a3a6f274c5234d10126d73b092db18b6
+FROM tomcat:${TOMCAT_IMAGE}
# Valid for arm64:
# FROM tomcat:9-jre11-temurin@sha256:96f05b79814a1fb0523e3063668b4e3be7a1bbb01e6e6b2757915764381825ac
#9.0-jre11-slim
#9.0.65-jdk11-openjdk-slim
-MAINTAINER thinkWhere
+LABEL maintainer="thinkWhere "
# Credit: Tim Sutton
# kartoza/docker-geoserver
@@ -25,16 +29,26 @@ RUN set -e \
ENV DEBIAN_FRONTEND=noninteractive \
GEOSERVER_DATA_DIR=/opt/geoserver/data_dir \
- GDAL_SKIP="ECW JP2ECW" \
- GDAL_DATA=/usr/local/gdal-data \
- # AMD64 architecture:
- LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/apr/lib:/usr/lib:/usr/lib/x86_64-linux-gnu"
- # ARM64 architecture:
- # LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/apr/lib:/usr/lib:/usr/lib/aarch64-linux-gnu"
+ GDAL_DATA=/usr/local/gdal-data \
+ LD_LIBRARY_PATH_BASE="/usr/lib/jni:/usr/local/apr/lib:/usr/lib"
RUN mkdir -p ${GEOSERVER_DATA_DIR}
+ARG TARGETARCH
+RUN set -e; \
+ ARCH_LIB_DIR="/usr/lib/x86_64-linux-gnu"; \
+ case "${TARGETARCH:-$(dpkg --print-architecture)}" in \
+ arm64|aarch64) ARCH_LIB_DIR="/usr/lib/aarch64-linux-gnu" ;; \
+ amd64|x86_64) ARCH_LIB_DIR="/usr/lib/x86_64-linux-gnu" ;; \
+ *) echo "Unknown architecture '${TARGETARCH:-$(dpkg --print-architecture)}', defaulting to amd64 library path" ;; \
+ esac; \
+ printf '%s\n' \
+ '#!/bin/sh' \
+ "export LD_LIBRARY_PATH=\${LD_LIBRARY_PATH:+\${LD_LIBRARY_PATH}:}${LD_LIBRARY_PATH_BASE}:${ARCH_LIB_DIR}" \
+ > "$CATALINA_HOME/bin/setenv.sh"; \
+ chmod +x "$CATALINA_HOME/bin/setenv.sh"
+
ADD resources /tmp/resources
# Optionally remove Tomcat manager, docs, and examples
@@ -49,28 +63,25 @@ RUN if [ "$TOMCAT_EXTRAS" = false ]; then \
# ---------- GS_Version will be passed in as a parameter ------------
ARG GS_VERSION
-
-# Add GDAL native libraries if the build-arg GDAL_NATIVE = true
-# EWC and JP2ECW are subjected to licence restrictions
-ARG GDAL_NATIVE=false
-RUN if [ "$GDAL_NATIVE" = true ]; then \
- wget --progress=bar http://demo.geo-solutions.it/share/github/imageio-ext/releases/1.1.X/1.1.16/native/gdal/gdal-data.zip \
- -O /tmp/resources/gdal-data.zip && \
- wget --progress=bar http://demo.geo-solutions.it/share/github/imageio-ext/releases/1.1.X/1.1.29/native/gdal/linux/gdal192-Ubuntu12-gcc4.6.3-x86_64.tar.gz \
- -O /tmp/resources/gdal192-Ubuntu12-gcc4.6.3-x86_64.tar.gz && \
- unzip /tmp/resources/gdal-data.zip -d /usr/local && \
- mkdir /usr/local/gdal_native_libs && \
- tar -xvf /tmp/resources/gdal192-Ubuntu12-gcc4.6.3-x86_64.tar.gz -C /usr/local/gdal_native_libs; \
- apt-get update; \
- apt-get install -y gdal-bin --fix-missing; \
-fi;
-
-
-# If using GDAL make sure extension is downloaded
+ARG GDAL_NATIVE=true
+
+# GDAL support is optional and enabled with build-arg GDAL_NATIVE=true.
+RUN --mount=from=gdal-builder,source=/usr/share/java,target=/tmp/gdal-builder-java \
+ --mount=from=gdal-builder,source=/usr/lib,target=/tmp/gdal-builder-lib \
+ if [ "$GDAL_NATIVE" = true ]; then \
+ cp -a /tmp/gdal-builder-java/. /usr/share/java/ \
+ && mkdir -p /usr/lib/jni \
+ && find /tmp/gdal-builder-lib -path "*/jni/*" -type f -exec cp {} /usr/lib/jni/ \; \
+ && apt-get update \
+ && apt-get install -y gdal-bin --fix-missing \
+ && ldconfig; \
+ fi
+
+# If GDAL native support is enabled, ensure GDAL extension is available.
RUN if [ "$GDAL_NATIVE" = true ] && [ ! -f /tmp/resources/plugins/geoserver-gdal-plugin.zip ]; then \
- wget --progress=bar -c http://downloads.sourceforge.net/project/geoserver/GeoServer/${GS_VERSION}/extensions/geoserver-${GS_VERSION}-gdal-plugin.zip \
- -O /tmp/resources/plugins/geoserver-gdal-plugin.zip; \
-fi;
+ wget --progress=bar -c http://downloads.sourceforge.net/project/geoserver/GeoServer/${GS_VERSION}/extensions/geoserver-${GS_VERSION}-gdal-plugin.zip \
+ -O /tmp/resources/plugins/geoserver-gdal-plugin.zip; \
+fi
WORKDIR $CATALINA_HOME
diff --git a/build/build-config.yml b/build/build-config.yml
new file mode 100644
index 0000000..8a89ffb
--- /dev/null
+++ b/build/build-config.yml
@@ -0,0 +1,27 @@
+# Centralized build configuration used by build.sh and build.bat
+# Keep values as plain scalars or comma-separated lists.
+#
+# ARM64 example overrides:
+gs_version: 2.28.4
+tomcat_image: 9.0.118-jdk17-temurin-noble
+gdal_version: 3.8.4
+gdal_native: true
+tomcat_extras: false
+build_platform: linux/arm64/v8
+
+#gs_version: 2.28.4
+#tomcat_image: 9.0.118-jdk17-temurin-noble
+#gdal_version: 3.8.4
+#gdal_native: true
+#tomcat_extras: false
+#build_platform: linux/amd64
+docker_image: thinkwhere/geoserver
+docker_tag: auto
+docker_label: org.opencontainers.image.vendor=thinkWhere
+
+# Stable GeoServer extension plugins (comma-separated)
+# Does not need to append GDAL plugin, as this is handled by the build script if gdal_native is true.
+plugins: control-flow,css,inspire,monitor,sldservice,ysld,web-resource,gwc-s3,vectortiles,ogcapi-features
+
+# Community GeoServer plugins (comma-separated)
+community_plugins: cog-s3,ogcapi-tiled-features
diff --git a/build/build.bat b/build/build.bat
index 69f16fb..3c19f8b 100644
--- a/build/build.bat
+++ b/build/build.bat
@@ -1,39 +1,80 @@
@Echo off
-SET GS_VERSION=2.18.3
-SET BUILD_GS_VERSION=%GS_VERSION:~0,4%
+SET "CONFIG_FILE=build-config.yml"
+
+if not exist "%CONFIG_FILE%" (
+ echo Config file not found: %CONFIG_FILE%
+ exit /b 1
+)
+
+for /f "tokens=1,* delims=:" %%A in ('findstr /b /c:"gs_version:" "%CONFIG_FILE%"') do set "GS_VERSION=%%B"
+for /f "tokens=1,* delims=:" %%A in ('findstr /b /c:"tomcat_image:" "%CONFIG_FILE%"') do set "TOMCAT_IMAGE=%%B"
+for /f "tokens=1,* delims=:" %%A in ('findstr /b /c:"gdal_version:" "%CONFIG_FILE%"') do set "GDAL_VERSION=%%B"
+for /f "tokens=1,* delims=:" %%A in ('findstr /b /c:"gdal_native:" "%CONFIG_FILE%"') do set "GDAL_NATIVE=%%B"
+for /f "tokens=1,* delims=:" %%A in ('findstr /b /c:"tomcat_extras:" "%CONFIG_FILE%"') do set "TOMCAT_EXTRAS=%%B"
+for /f "tokens=1,* delims=:" %%A in ('findstr /b /c:"build_platform:" "%CONFIG_FILE%"') do set "BUILD_PLATFORM=%%B"
+for /f "tokens=1,* delims=:" %%A in ('findstr /b /c:"plugins:" "%CONFIG_FILE%"') do set "plugins=%%B"
+for /f "tokens=1,* delims=:" %%A in ('findstr /b /c:"community_plugins:" "%CONFIG_FILE%"') do set "community_plugins=%%B"
+
+for /f "tokens=* delims= " %%A in ("%GS_VERSION%") do set "GS_VERSION=%%A"
+for /f "tokens=* delims= " %%A in ("%TOMCAT_IMAGE%") do set "TOMCAT_IMAGE=%%A"
+for /f "tokens=* delims= " %%A in ("%GDAL_VERSION%") do set "GDAL_VERSION=%%A"
+for /f "tokens=* delims= " %%A in ("%GDAL_NATIVE%") do set "GDAL_NATIVE=%%A"
+for /f "tokens=* delims= " %%A in ("%TOMCAT_EXTRAS%") do set "TOMCAT_EXTRAS=%%A"
+for /f "tokens=* delims= " %%A in ("%BUILD_PLATFORM%") do set "BUILD_PLATFORM=%%A"
+for /f "tokens=* delims= " %%A in ("%plugins%") do set "plugins=%%A"
+for /f "tokens=* delims= " %%A in ("%community_plugins%") do set "community_plugins=%%A"
+
+set "GS_VERSION=%GS_VERSION:\"=%"
+set "TOMCAT_IMAGE=%TOMCAT_IMAGE:\"=%"
+set "GDAL_VERSION=%GDAL_VERSION:\"=%"
+set "GDAL_NATIVE=%GDAL_NATIVE:\"=%"
+set "TOMCAT_EXTRAS=%TOMCAT_EXTRAS:\"=%"
+set "BUILD_PLATFORM=%BUILD_PLATFORM:\"=%"
+set "plugins=%plugins:\"=%"
+set "community_plugins=%community_plugins:\"=%"
+
+for /f "tokens=1,2 delims=." %%A in ("%GS_VERSION%") do set "BUILD_GS_VERSION=%%A.%%B"
+
+set "plugins=%plugins:,= %"
+set "community_plugins=%community_plugins:,= %"
rem Create plugins folder if does not exist
if not exist .\resources\NUL mkdir .\resources
if not exist .\resources\plugins\NUL mkdir .\resources\plugins
-SET plugins=control-flow,inspire,monitor,css,ysld,web-resource,sldservice,gwc-s3
-
-rem Download plugins from list above. Modify list as required
+rem Download plugins from configuration
rem works for windows 10 powershell
for %%f in (%plugins%) do (
- if not exist resources\plugins\geoserver-%%f-plugin.zip powershell.exe Invoke-WebRequest -OutFile resources/plugins/geoserver-%%f-plugin.zip -Uri https://sourceforge.net/projects/geoserver/files/GeoServer/%GS_VERSION%/extensions/geoserver-%GS_VERSION%-%%f-plugin.zip/download -UserAgent [Microsoft.PowerShell.Commands.PSUserAgent]::Chrome
- @ECHO geoserver-%%f-plugin downloaded.
+ if exist resources\plugins\geoserver-%%f-plugin.zip (
+ @ECHO Skipping existing plugin: geoserver-%%f-plugin.zip
+ ) else (
+ powershell.exe Invoke-WebRequest -OutFile resources/plugins/geoserver-%%f-plugin.zip -Uri https://sourceforge.net/projects/geoserver/files/GeoServer/%GS_VERSION%/extensions/geoserver-%GS_VERSION%-%%f-plugin.zip/download -UserAgent [Microsoft.PowerShell.Commands.PSUserAgent]::Chrome
+ @ECHO geoserver-%%f-plugin downloaded.
+ )
)
-SET community_plugins=cog
-
rem Community plugins are not available from sourgeforge
rem therefore source from https://build.geoserver.org/
for %%f in (%community_plugins%) do (
- if not exist resources\plugins\geoserver-%%f-plugin.zip powershell.exe Invoke-WebRequest -OutFile resources/plugins/geoserver-%%f-plugin.zip -Uri https://build.geoserver.org/geoserver/%BUILD_GS_VERSION%.x/community-latest/geoserver-%BUILD_GS_VERSION%-SNAPSHOT-%%f-plugin.zip -UserAgent [Microsoft.PowerShell.Commands.PSUserAgent]::Chrome
- @ECHO geoserver-%%f-plugin downloaded.
+ if exist resources\plugins\geoserver-%%f-plugin.zip (
+ @ECHO Skipping existing community plugin: geoserver-%%f-plugin.zip
+ ) else (
+ powershell.exe Invoke-WebRequest -OutFile resources/plugins/geoserver-%%f-plugin.zip -Uri https://build.geoserver.org/geoserver/%BUILD_GS_VERSION%.x/community-latest/geoserver-%BUILD_GS_VERSION%-SNAPSHOT-%%f-plugin.zip -UserAgent [Microsoft.PowerShell.Commands.PSUserAgent]::Chrome
+ @ECHO geoserver-%%f-plugin downloaded.
+ )
)
rem Build options include:
rem TOMCAT_EXTRAS [true | false]
-rem GDAL_NATIVE [true | false] - default false; build with GDAL support
+rem GDAL_NATIVE [true | false] - default true in Dockerfile, override here as needed
rem GS_VERSION - specifies which version of geoserver is to be built
-rem Valid for AMD64 (i.e., t3a.medium)
-rem docker build --build-arg GS_VERSION=${GS_VERSION} --build-arg TOMCAT_EXTRAS=false --build-arg GDAL_NATIVE=true -t thinkwhere/geoserver:${GS_VERSION} .
-rem Valid also for ARM64 (i.e., t4g.medium)
-docker buildx build --build-arg GS_VERSION=%GS_VERSION% --build-arg TOMCAT_EXTRAS=false --build-arg GDAL_NATIVE=false --platform linux/arm64/v8 -t thinkwhere/geoserver:%GS_VERSION% --push .
+rem Local AMD64 build (no push)
+docker build --platform %BUILD_PLATFORM% --build-arg GS_VERSION=%GS_VERSION% --build-arg TOMCAT_IMAGE=%TOMCAT_IMAGE% --build-arg GDAL_VERSION=%GDAL_VERSION% --build-arg TOMCAT_EXTRAS=%TOMCAT_EXTRAS% --build-arg GDAL_NATIVE=%GDAL_NATIVE% -t thinkwhere/geoserver:%GS_VERSION% .
+
+rem ARM64 build example (uncomment if needed)
+rem docker buildx build --build-arg GS_VERSION=%GS_VERSION% --build-arg TOMCAT_EXTRAS=false --build-arg GDAL_NATIVE=false --platform linux/arm64/v8 -t thinkwhere/geoserver:%GS_VERSION% --push .
diff --git a/build/build.sh b/build/build.sh
index 41db27d..9743e8c 100644
--- a/build/build.sh
+++ b/build/build.sh
@@ -1,5 +1,22 @@
#!/bin/bash
+CONFIG_FILE="${CONFIG_FILE:-./build-config.yml}"
+
+if [ ! -f "$CONFIG_FILE" ]
+then
+ echo "Config file not found: $CONFIG_FILE"
+ exit 1
+fi
+
+cfg_get() {
+ local key="$1"
+ local value
+ value=$(grep -E "^${key}:" "$CONFIG_FILE" | head -n 1 | sed -E "s/^${key}:[[:space:]]*//")
+ value=${value//\"/}
+ value=${value//\'/}
+ echo "$value"
+}
+
# Create plugins folder if does not exist
if [ ! -d ./resources ]
then
@@ -11,28 +28,43 @@ then
mkdir ./resources/plugins
fi
-GS_VERSION=2.26.0
-BUILD_GS_VERSION=${GS_VERSION:0:-2}
+GS_VERSION=$(cfg_get gs_version)
+TOMCAT_IMAGE=$(cfg_get tomcat_image)
+GDAL_VERSION=$(cfg_get gdal_version)
+GDAL_NATIVE=$(cfg_get gdal_native)
+TOMCAT_EXTRAS=$(cfg_get tomcat_extras)
+BUILD_PLATFORM=$(cfg_get build_platform)
+PLUGINS_CSV=$(cfg_get plugins)
+COMMUNITY_PLUGINS_CSV=$(cfg_get community_plugins)
+
+BUILD_GS_VERSION=${GS_VERSION%.*}
-# Add in selected plugins. Comment out or modify as required
-plugins=(control-flow inspire monitor css ysld web-resource sldservice gwc-s3)
+IFS=',' read -r -a plugins <<< "$PLUGINS_CSV"
+IFS=',' read -r -a community_plugins <<< "$COMMUNITY_PLUGINS_CSV"
for p in "${plugins[@]}"
do
- if [ ! -f resources/plugins/geoserver-${p}-plugin.zip ]
+ p=$(echo "$p" | xargs)
+ [ -z "$p" ] && continue
+ if [ ! -s resources/plugins/geoserver-${p}-plugin.zip ]
then
- wget -c http://downloads.sourceforge.net/project/geoserver/GeoServer/${GS_VERSION}/extensions/geoserver-${GS_VERSION}-${p}-plugin.zip -O resources/plugins/geoserver-${p}-plugin.zip
+ wget https://sourceforge.net/projects/geoserver/files/GeoServer/${GS_VERSION}/extensions/geoserver-${GS_VERSION}-${p}-plugin.zip/download -O resources/plugins/geoserver-${p}-plugin.zip
+ echo "geoserver-${p}-plugin downloaded."
+ else
+ echo "Skipping existing plugin: geoserver-${p}-plugin.zip"
fi
done
-# Community plugins are not available from sourgeforge
-# therefore source from https://build.geoserver.org/
-community_plugins=(cog-s3 jms-cluster) # activeMQ-broker )
for c in "${community_plugins[@]}"
do
- if [ ! -f resources/plugins/geoserver-${c}-plugin.zip ]
+ c=$(echo "$c" | xargs)
+ [ -z "$c" ] && continue
+ if [ ! -s resources/plugins/geoserver-${c}-plugin.zip ]
then
- wget -c http://build.geoserver.org/geoserver/${BUILD_GS_VERSION}.x/community-latest/geoserver-${BUILD_GS_VERSION}-SNAPSHOT-${c}-plugin.zip -O resources/plugins/geoserver-${c}-plugin.zip
+ wget https://build.geoserver.org/geoserver/${BUILD_GS_VERSION}.x/community-latest/geoserver-${BUILD_GS_VERSION}-SNAPSHOT-${c}-plugin.zip -O resources/plugins/geoserver-${c}-plugin.zip
+ echo "geoserver-${c}-plugin downloaded."
+ else
+ echo "Skipping existing community plugin: geoserver-${c}-plugin.zip"
fi
done
@@ -42,6 +74,6 @@ done
# GS_VERSION - specifies which version of geoserver is to be built
# Valid for AMD64 (i.e., t3a.medium)
-docker build --build-arg GS_VERSION=${GS_VERSION} --build-arg TOMCAT_EXTRAS=false --build-arg GDAL_NATIVE=true -t thinkwhere/geoserver:${GS_VERSION} .
+docker build --platform ${BUILD_PLATFORM} --build-arg GS_VERSION=${GS_VERSION} --build-arg TOMCAT_IMAGE=${TOMCAT_IMAGE} --build-arg GDAL_VERSION=${GDAL_VERSION} --build-arg TOMCAT_EXTRAS=${TOMCAT_EXTRAS} --build-arg GDAL_NATIVE=${GDAL_NATIVE} -t thinkwhere/geoserver:${GS_VERSION} .
# Valid also for ARM64 (i.e., t4g.medium)
# docker buildx build --build-arg GS_VERSION=${GS_VERSION} --build-arg TOMCAT_EXTRAS=false --build-arg GDAL_NATIVE=false --platform linux/arm64/v8 -t thinkwhere/geoserver:${GS_VERSION} --push .
\ No newline at end of file
diff --git a/build/download.sh b/build/download.sh
index bb11611..472dc9b 100644
--- a/build/download.sh
+++ b/build/download.sh
@@ -1,10 +1,35 @@
#!/bin/bash
-# GS_VERSION param and abbreviated version
-GS_VERSION=$1
-echo "Build $GS_VERSION"
-BUILD_GS_VERSION=${GS_VERSION:0:-2}
-echo "Build Minor $BUILD_GS_VERSION"
+set -euo pipefail
+
+CONFIG_FILE="${CONFIG_FILE:-./build-config.yml}"
+
+if [ ! -f "$CONFIG_FILE" ]
+then
+ echo "Config file not found: $CONFIG_FILE"
+ exit 1
+fi
+
+cfg_get() {
+ local key="$1"
+ local value
+ value=$(grep -E "^${key}:" "$CONFIG_FILE" | head -n 1 | sed -E "s/^${key}:[[:space:]]*//")
+ value=${value//\"/}
+ value=${value//\'/}
+ echo "$value"
+}
+
+# GS_VERSION can be passed as first arg; fallback to config value.
+GS_VERSION="${1:-$(cfg_get gs_version)}"
+BUILD_GS_VERSION=${GS_VERSION%.*}
+PLUGINS_CSV=$(cfg_get plugins)
+COMMUNITY_PLUGINS_CSV=$(cfg_get community_plugins)
+
+IFS=',' read -r -a plugins <<< "$PLUGINS_CSV"
+IFS=',' read -r -a community_plugins <<< "$COMMUNITY_PLUGINS_CSV"
+
+echo "Build ${GS_VERSION}"
+echo "Build minor ${BUILD_GS_VERSION}"
# Create plugins folder if does not exist
if [ ! -d ./resources ]
@@ -17,26 +42,30 @@ then
mkdir ./resources/plugins
fi
-# Add in selected plugins. Comment out or modify as required
-plugins=(control-flow inspire monitor css ysld web-resource sldservice gwc-s3)
-
for p in "${plugins[@]}"
do
- if [ ! -f resources/plugins/geoserver-${p}-plugin.zip ]
+ p=$(echo "$p" | xargs)
+ [ -z "$p" ] && continue
+ if [ ! -s resources/plugins/geoserver-${p}-plugin.zip ]
then
- # https://sourceforge.net/projects/geoserver/files/GeoServer/2.23.0/extensions/geoserver-2.23.0-gdal-plugin.zip
- wget -c http://downloads.sourceforge.net/project/geoserver/GeoServer/${GS_VERSION}/extensions/geoserver-${GS_VERSION}-${p}-plugin.zip -O resources/plugins/geoserver-${p}-plugin.zip
+ wget https://sourceforge.net/projects/geoserver/files/GeoServer/${GS_VERSION}/extensions/geoserver-${GS_VERSION}-${p}-plugin.zip/download -O resources/plugins/geoserver-${p}-plugin.zip
+ echo "geoserver-${p}-plugin downloaded."
+ else
+ echo "Skipping existing plugin: geoserver-${p}-plugin.zip"
fi
done
# Community plugins are not available from sourgeforge
# therefore source from https://build.geoserver.org/
-community_plugins=(cog-s3 jms-cluster) #activeMQ-broker )
for c in "${community_plugins[@]}"
do
- if [ ! -f resources/plugins/geoserver-${c}-plugin.zip ]
+ c=$(echo "$c" | xargs)
+ [ -z "$c" ] && continue
+ if [ ! -s resources/plugins/geoserver-${c}-plugin.zip ]
then
- # https://build.geoserver.org/geoserver/2.23.x/community-latest/geoserver-2.23-SNAPSHOT-jms-cluster-plugin.zip
- wget -c http://build.geoserver.org/geoserver/${BUILD_GS_VERSION}.x/community-latest/geoserver-${BUILD_GS_VERSION}-SNAPSHOT-${c}-plugin.zip -O resources/plugins/geoserver-${c}-plugin.zip
+ wget https://build.geoserver.org/geoserver/${BUILD_GS_VERSION}.x/community-latest/geoserver-${BUILD_GS_VERSION}-SNAPSHOT-${c}-plugin.zip -O resources/plugins/geoserver-${c}-plugin.zip
+ echo "geoserver-${c}-plugin downloaded."
+ else
+ echo "Skipping existing community plugin: geoserver-${c}-plugin.zip"
fi
done
diff --git a/build/run.bat b/build/run.bat
index 4ed7978..8444f3e 100644
--- a/build/run.bat
+++ b/build/run.bat
@@ -1,3 +1,20 @@
-SET GS_PORT=8080
+@Echo off
+SET "CONFIG_FILE=build-config.yml"
+SET "GS_PORT=8085"
+SET "DATA_DIR=%~dp0resources\data_dir"
-docker run --name=geoserver_%GS_PORT% -p %GS_PORT%:8080 -d -v %HOME%/geoserver_data:/opt/geoserver/data_dir -e "HTTP_MAX_HEADER_SIZE=524288" -t thinkwhere/geoserver:2.18.3 /bin/sh -c conf/update_tomcat_settings.sh
+if not exist "%CONFIG_FILE%" (
+ echo Config file not found: %CONFIG_FILE%
+ exit /b 1
+)
+
+for /f "tokens=1,* delims=:" %%A in ('findstr /b /c:"gs_version:" "%CONFIG_FILE%"') do set "GS_VERSION=%%B"
+for /f "tokens=* delims= " %%A in ("%GS_VERSION%") do set "GS_VERSION=%%A"
+set "GS_VERSION=%GS_VERSION:\"=%"
+
+for %%I in ("%DATA_DIR%") do set "DATA_DIR=%%~fI"
+
+if not exist "%DATA_DIR%" mkdir "%DATA_DIR%"
+
+docker rm -f geoserver_%GS_PORT% >NUL 2>&1
+docker run --name=geoserver_%GS_PORT% -p %GS_PORT%:8080 -d -v "%DATA_DIR%:/opt/geoserver/data_dir" -e "GEOSERVER_LOG_LOCATION=/opt/geoserver/data_dir/logs/geoserver_%GS_PORT%.log" -t thinkwhere/geoserver:%GS_VERSION%
diff --git a/docker-compose.yml b/docker-compose.deprecated.yml
similarity index 95%
rename from docker-compose.yml
rename to docker-compose.deprecated.yml
index e0f1556..97dede3 100644
--- a/docker-compose.yml
+++ b/docker-compose.deprecated.yml
@@ -12,7 +12,7 @@ services:
ports:
- "80:8080"
volumes:
- - ~/nginx/nginx.conf:/etc/nginx/nginx.conf:ro
+ - ~/nginx/nginx-for-testing.conf:/etc/nginx/nginx.conf:ro
links:
- geoserver_8085
- geoserver_8086
diff --git a/nginx/nginx.conf b/nginx/nginx-for-testing.conf
similarity index 100%
rename from nginx/nginx.conf
rename to nginx/nginx-for-testing.conf
diff --git a/run.sh b/run.sh
index 4aa5234..e81ba96 100755
--- a/run.sh
+++ b/run.sh
@@ -1,21 +1,39 @@
#!/bin/bash
-docker kill geoserver_8085
-docker rm geoserver_8085
-DATA_DIR=~/geoserver_data
-if [ ! -d $DATA_DIR ]
+set -euo pipefail
+
+CONFIG_FILE="${CONFIG_FILE:-./build/build-config.yml}"
+GS_PORT="${GS_PORT:-8085}"
+DATA_DIR="${DATA_DIR:-$(pwd)/build/resources/data_dir}"
+
+if [ ! -f "$CONFIG_FILE" ]
then
- mkdir -p $DATA_DIR
-fi
+ echo "Config file not found: $CONFIG_FILE"
+ exit 1
+fi
+
+cfg_get() {
+ local key="$1"
+ local value
+ value=$(grep -E "^${key}:" "$CONFIG_FILE" | head -n 1 | sed -E "s/^${key}:[[:space:]]*//")
+ value=${value//\"/}
+ value=${value//\'/}
+ echo "$value"
+}
+
+GS_VERSION=$(cfg_get gs_version)
+
+mkdir -p "$DATA_DIR"
+docker rm -f geoserver_${GS_PORT} >/dev/null 2>&1 || true
docker run \
- --name=geoserver_8085 \
- -p 8085:8080 \
+ --name=geoserver_${GS_PORT} \
+ -p ${GS_PORT}:8080 \
-d \
- -v $DATA_DIR:/opt/geoserver/data_dir \
- -e "GEOSERVER_LOG_LOCATION=/opt/geoserver/data_dir/logs/geoserver_8085.log" \
- -t thinkwhere/geoserver:latest
+ -v "$DATA_DIR:/opt/geoserver/data_dir" \
+ -e "GEOSERVER_LOG_LOCATION=/opt/geoserver/data_dir/logs/geoserver_${GS_PORT}.log" \
+ -t thinkwhere/geoserver:${GS_VERSION}
# alt docker run command if s3-geotiff plugin is used