From fe50c5e1df04b229f7f50a66a76b65a1df5ba992 Mon Sep 17 00:00:00 2001 From: Henning Bredel Date: Tue, 23 Jan 2024 11:56:08 +0100 Subject: [PATCH] Adds 52n workflows --- .github/actions/52n-build_and_push/action.yml | 91 +++++++++++++++++ .github/workflows/52n-latest.yml | 96 ++++++++++++++++++ .github/workflows/52n-release.yml | 98 +++++++++++++++++++ 3 files changed, 285 insertions(+) create mode 100644 .github/actions/52n-build_and_push/action.yml create mode 100644 .github/workflows/52n-latest.yml create mode 100644 .github/workflows/52n-release.yml diff --git a/.github/actions/52n-build_and_push/action.yml b/.github/actions/52n-build_and_push/action.yml new file mode 100644 index 0000000..574b15d --- /dev/null +++ b/.github/actions/52n-build_and_push/action.yml @@ -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 \ No newline at end of file diff --git a/.github/workflows/52n-latest.yml b/.github/workflows/52n-latest.yml new file mode 100644 index 0000000..8b95abe --- /dev/null +++ b/.github/workflows/52n-latest.yml @@ -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 }} + \ No newline at end of file diff --git a/.github/workflows/52n-release.yml b/.github/workflows/52n-release.yml new file mode 100644 index 0000000..5742377 --- /dev/null +++ b/.github/workflows/52n-release.yml @@ -0,0 +1,98 @@ +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: 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: 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: 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: 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 }}