Skip to content

Commit

Permalink
Adds 52n workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
ridoo committed Jan 23, 2024
1 parent 1c29476 commit 329ea39
Show file tree
Hide file tree
Showing 3 changed files with 348 additions and 0 deletions.
91 changes: 91 additions & 0 deletions .github/actions/52n-build_and_push/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Builds and pushes Docker image
description: Action to build and push images to docker


inputs:
dockerfile:
description: Path to the Dockerfile
default: ./Dockerfile
required: false
dockercontext:
description: Path to the Docker context
default: ./
required: false
# image coordinates
image:
description: Name of the image to build
required: true
tags:
description: Image Tag(s)
required: false
default: latest
allow_tag_override:
description: Allow to override Tag(s)
required: true
# OCI metadata annotations
oci_title:
description: Image Title (OCI annotation)
required: true
oci_description:
description: Image Description (OCI annotation)
required: true
# registry credentials
registry_username:
description: The username for Docker hub sign-in
required: true
registry_password:
description: The password for Docker hub sign-in
required: true


runs:
using: "composite"
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ inputs.image }}
labels: |
"org.opencontainers.image.vendor=52°North GmbH"
"org.opencontainers.image.authors=https://52North.org/"
"org.opencontainers.image.source=https://github.com/52North/geonode"
"org.opencontainers.image.description=${{ inputs.oci_description }}"
"org.opencontainers.image.title=${{ inputs.oci_title }}"
"org.opencontainers.image.licenses=GPL-3.0"
tags: |
latest
${{ inputs.tags }}
-
name: Login to Docker registry
uses: docker/login-action@v2
with:
username: ${{ inputs.registry_username }}
password: ${{ inputs.registry_password }}
-
name: Fail in case fully tagged version already exists
if: ${{ inputs.allow_tag_override == false || inputs.allow_tag_override == 'false' }}
shell: bash
run: |
if docker manifest inspect ${{ env.IMAGE }}:${{ steps.semver_parser.outputs.fullversion }}; then
echo "tag version already exists! Will not override."
exit 1
fi
-
name: Build and push
uses: docker/build-push-action@v4
with:
context: ${{ inputs.dockercontext }}
file: ${{ inputs.dockerfile }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=${{ inputs.image }}:buildcache
cache-to: type=registry,ref=${{ inputs.image }}:buildcache,mode=max
96 changes: 96 additions & 0 deletions .github/workflows/52n-latest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: "[52n-4.2.x -> 4.2.x] Builds GeoNode Docker Images"

concurrency:
group: "geonode_build_4.2.x"
cancel-in-progress: true

env:
TAG: 4.2.x

on:
push:
branches:
- "52n-4.2.x"

jobs:
build_and_push_geoserver:
runs-on: ubuntu-22.04
env:
IMAGE: 52north/geonode-geoserver
steps:
- name: Checkout
uses: actions/checkout@v3
- name: build and push geoserver
uses: ./.github/actions/52n-build_and_push
with:
dockerfile: ./docker/geoserver/Dockerfile
dockercontext: ./docker/geoserver/
image: 52north/geonode-geoserver
tags: ${{ env.TAG }}
allow_tag_override: "true"
oci_title: "52°North GeoServer image for GeoNode"
oci_description: "GeoServer built for GeoNode from 52north/geonode-docker"
registry_username: ${{ secrets.DOCKERHUB_USERNAME }}
registry_password: ${{ secrets.DOCKERHUB_TOKEN }}


build_and_push_geoserver_data:
runs-on: ubuntu-22.04
env:
IMAGE: 52north/geonode-geoserver_data
steps:
- name: Checkout
uses: actions/checkout@v3
- name: build and push geoserver_data
uses: ./.github/actions/52n-build_and_push
with:
dockerfile: ./docker/geoserver_data/Dockerfile
dockercontext: ./docker/geoserver_data/
image: 52north/geonode-geoserver_data
tags: ${{ env.TAG }}
allow_tag_override: "true"
oci_title: "52°North GeoServer data image for GeoNode"
oci_description: "GeoServer Data built for GeoNode from 52north/geonode-docker"
registry_username: ${{ secrets.DOCKERHUB_USERNAME }}
registry_password: ${{ secrets.DOCKERHUB_TOKEN }}


build_and_push_nginx:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: build and push nginx
uses: ./.github/actions/52n-build_and_push
with:
dockerfile: ./docker/nginx/Dockerfile
dockercontext: ./docker/nginx/
image: 52north/geonode-nginx
tags: ${{ env.TAG }}
allow_tag_override: "true"
oci_title: "52°North Nginx image for GeoNode"
oci_description: "Nginx built for GeoNode from 52north/geonode-docker"
registry_username: ${{ secrets.DOCKERHUB_USERNAME }}
registry_password: ${{ secrets.DOCKERHUB_TOKEN }}


build_and_push_postgis:
runs-on: ubuntu-22.04
env:
IMAGE: 52north/geonode-postgis
steps:
- name: Checkout
uses: actions/checkout@v3
- name: build and push postgis
uses: ./.github/actions/52n-build_and_push
with:
dockerfile: ./docker/postgis/Dockerfile
dockercontext: ./docker/postgis/
image: 52north/geonode-postgis
tags: ${{ env.TAG }}
allow_tag_override: "true"
oci_title: "52°North PostGIS image for GeoNode"
oci_description: "PostGIS Data built for GeoNode from 52north/geonode-docker"
registry_username: ${{ secrets.DOCKERHUB_USERNAME }}
registry_password: ${{ secrets.DOCKERHUB_TOKEN }}

161 changes: 161 additions & 0 deletions .github/workflows/52n-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
name: Release Docker Image (Build and Push)

concurrency:
group: "geonode-docker_build_release"
cancel-in-progress: true

env:
TITLE: "52°North GeoNode Docker Image"
VENDOR: "52°North GmbH"
AUTHORS: "https://52North.org/"
DESCRIPTION: "Builds and publishes the Docker images GeoNode, GeoServer, Nginx"
LICENSE: "GPL-3.0"

on:
release:
types: [published]

jobs:
build_and_push_geoserver:
runs-on: ubuntu-22.04
env:
IMAGE: 52north/geonode-geoserver
steps:
- name: Checkout
uses: actions/checkout@v3
-
name: Parse semver string
id: semver_parser
uses: booxmedialtd/ws-action-parse-semver@v1
with:
input_string: "${{github.ref_name}}"
version_extractor_regex: '(.*)-52n'
-
name: Provide version tags
shell: bash
run: |
echo "MAJOR_VERSION="${{ steps.semver_parser.outputs.major }}"" >> "$env.TAG"
echo "MAJOR_MINOR_VERSION="${{ steps.semver_parser.outputs.major }}.${{ steps.semver_parser.outputs.minor }}"" >> "$env.TAG"
echo "MAJOR_MINOR_PATCH_VERSION="${{ steps.semver_parser.outputs.fullversion }}"" >> "$env.TAG"
-
name: build and push geoserver
uses: ./.github/actions/52n-build_and_push
with:
dockerfile: ./docker/geoserver/Dockerfile
dockercontext: ./docker/geoserver/
image: 52north/geonode-geoserver
tags: ${{ env.TAG }}
allow_tag_override: "false"
oci_title: "52°North GeoServer image for GeoNode"
oci_description: "GeoServer built for GeoNode from 52north/geonode-docker"
registry_username: ${{ secrets.DOCKERHUB_USERNAME }}
registry_password: ${{ secrets.DOCKERHUB_TOKEN }}


build_and_push_geoserver_data:
runs-on: ubuntu-22.04
env:
IMAGE: 52north/geonode-geoserver_data
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Parse semver string
id: semver_parser
uses: booxmedialtd/ws-action-parse-semver@v1
with:
input_string: "${{github.ref_name}}"
version_extractor_regex: '(.*)-52n'
-
name: Provide version tags to GITHUB_ENV
shell: bash
run: |
echo "MAJOR_VERSION="${{ steps.semver_parser.outputs.major }}"" >> "$env.TAG"
echo "MAJOR_MINOR_VERSION="${{ steps.semver_parser.outputs.major }}.${{ steps.semver_parser.outputs.minor }}"" >> "$env.TAG"
echo "MAJOR_MINOR_PATCH_VERSION="${{ steps.semver_parser.outputs.fullversion }}"" >> "$env.TAG"
-
name: build and push geoserver_data
uses: ./.github/actions/52n-build_and_push
with:
dockerfile: ./docker/geoserver_data/Dockerfile
dockercontext: ./docker/geoserver_data/
image: 52north/geonode-geoserver_data
tags: ${{ env.TAG }}
allow_tag_override: "false"
oci_title: "52°North GeoServer data image for GeoNode"
oci_description: "GeoServer Data built for GeoNode from 52north/geonode-docker"
registry_username: ${{ secrets.DOCKERHUB_USERNAME }}
registry_password: ${{ secrets.DOCKERHUB_TOKEN }}


build_and_push_nginx:
runs-on: ubuntu-22.04
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Parse semver string
id: semver_parser
uses: booxmedialtd/ws-action-parse-semver@v1
with:
input_string: "${{github.ref_name}}"
version_extractor_regex: '(.*)-52n'
-
name: Provide version tags to GITHUB_ENV
shell: bash
run: |
echo "MAJOR_VERSION="${{ steps.semver_parser.outputs.major }}"" >> "$env.TAG"
echo "MAJOR_MINOR_VERSION="${{ steps.semver_parser.outputs.major }}.${{ steps.semver_parser.outputs.minor }}"" >> "$env.TAG"
echo "MAJOR_MINOR_PATCH_VERSION="${{ steps.semver_parser.outputs.fullversion }}"" >> "$env.TAG"
-
name: build and push nginx
uses: ./.github/actions/52n-build_and_push
with:
dockerfile: ./docker/nginx/Dockerfile
dockercontext: ./docker/nginx/
image: 52north/geonode-nginx
tags: ${{ env.TAG }}
allow_tag_override: "false"
oci_title: "52°North Nginx image for GeoNode"
oci_description: "Nginx built for GeoNode from 52north/geonode-docker"
registry_username: ${{ secrets.DOCKERHUB_USERNAME }}
registry_password: ${{ secrets.DOCKERHUB_TOKEN }}


build_and_push_postgis:
runs-on: ubuntu-22.04
env:
IMAGE: 52north/geonode-postgis
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Parse semver string
id: semver_parser
uses: booxmedialtd/ws-action-parse-semver@v1
with:
input_string: "${{github.ref_name}}"
version_extractor_regex: '(.*)-52n'
-
name: Provide version tags to GITHUB_ENV
shell: bash
run: |
echo "MAJOR_VERSION="${{ steps.semver_parser.outputs.major }}"" >> "$env.TAG"
echo "MAJOR_MINOR_VERSION="${{ steps.semver_parser.outputs.major }}.${{ steps.semver_parser.outputs.minor }}"" >> "$env.TAG"
echo "MAJOR_MINOR_PATCH_VERSION="${{ steps.semver_parser.outputs.fullversion }}"" >> "$env.TAG"
-
name: build and push postgis
uses: ./.github/actions/52n-build_and_push
with:
dockerfile: ./docker/postgis/Dockerfile
dockercontext: ./docker/postgis/
image: 52north/geonode-postgis
tags: ${{ env.TAG }}
allow_tag_override: "false"
oci_title: "52°North PostGIS image for GeoNode"
oci_description: "PostGIS Data built for GeoNode from 52north/geonode-docker"
registry_username: ${{ secrets.DOCKERHUB_USERNAME }}
registry_password: ${{ secrets.DOCKERHUB_TOKEN }}

0 comments on commit 329ea39

Please sign in to comment.