Skip to content

Commit

Permalink
Build geoserver package
Browse files Browse the repository at this point in the history
  • Loading branch information
eliotjordan committed Aug 16, 2024
1 parent c10f9e9 commit d02c8d6
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 1 deletion.
62 changes: 62 additions & 0 deletions .github/workflows/build-docker-images.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Build docker images

on:
pull_request:
push:
branches:
- main
workflow_dispatch:

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
BRANCH: ${{ github.head_ref || github.ref_name }}

jobs:
build-geoblacklight-docker:
runs-on: ubuntu-latest
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Get geoserver version from dockerfile
id: package_version
run: echo "version=$(grep -Pio '(?<=ARG VERSION=).*' ./geoserver/Dockerfile)" >> $GITHUB_OUTPUT

# On pull request
- name: Build and push geobalcklight Docker image
uses: docker/build-push-action@v6
if: github.event_name == 'pull_request'
with:
context: "${{ github.workspace }}/geoserver/"
file: "${{ github.workspace }}/geoserver/Dockerfile"
push: true
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max
tags: ghcr.io/geoblacklight/geoserver:${{ steps.package_version.outputs.version }}

# On push to main
- name: Build and push branch Docker image
uses: docker/build-push-action@v6
if: github.event_name == 'workflow_dispatch' || github.event_name == 'push'
with:
context: "${{ github.workspace }}/geoserver/"
file: "${{ github.workspace }}/geoserver/Dockerfile"
push: true
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max
tags: |
ghcr.io/geoblacklight/geoserver:${{ steps.package_version.outputs.version }}
ghcr.io/geoblacklight/geoserver:latest
3 changes: 2 additions & 1 deletion geoserver/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
FROM docker.osgeo.org/geoserver:2.25.3
ARG VERSION=2.25.3
FROM docker.osgeo.org/geoserver:$VERSION
RUN rm -rf $GEOSERVER_DATA_DIR
ADD geoserver_data/ /opt/geoserver_data/

0 comments on commit d02c8d6

Please sign in to comment.