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 b2e684e
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 1 deletion.
63 changes: 63 additions & 0 deletions .github/workflows/build-docker-images.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
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:
- uses: actions/checkout@v4
- 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 b2e684e

Please sign in to comment.