From 4640e4615b691d3d67024e400bd03464390e99d2 Mon Sep 17 00:00:00 2001 From: Guillaume DE OLIVEIRA Date: Thu, 28 Aug 2025 09:21:23 +0200 Subject: [PATCH 1/6] add the datahub plugin docker image --- 4.4.8/Dockerfile.datahub-plugin | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 4.4.8/Dockerfile.datahub-plugin diff --git a/4.4.8/Dockerfile.datahub-plugin b/4.4.8/Dockerfile.datahub-plugin new file mode 100644 index 0000000..0d92906 --- /dev/null +++ b/4.4.8/Dockerfile.datahub-plugin @@ -0,0 +1,21 @@ +# Use the official GeoNetwork v4.4.8 image as the base +FROM geonetwork:4.4.8 + +ARG GEONETWORK_VERSION=4.4.8 +ARG PLUGIN_VERSION=${GEONETWORK_VERSION} +ARG PLUGIN_DOWNLOAD_URL="https://sourceforge.net/projects/geonetwork/files/GeoNetwork_opensource/v${GEONETWORK_VERSION}/gn-datahub-integration-${PLUGIN_VERSION}-0.zip/download" + +USER root + +RUN apt-get update && \ + apt-get install -y \ + wget \ + unzip && \ + rm -rf /var/lib/apt/lists/* + +USER jetty + +RUN wget -O /tmp/gn-plugin-datahub-integration.zip ${PLUGIN_DOWNLOAD_URL} \ + && unzip /tmp/gn-plugin-datahub-integration.zip -d /tmp/plugin \ + && cp /tmp/plugin/gn-datahub-integration-${PLUGIN_VERSION}-0/lib/*.jar /opt/geonetwork/WEB-INF/lib/ \ + && rm -rf /tmp/plugin /tmp/gn-plugin-datahub-integration.zip \ No newline at end of file From 6d4545c80a220733bcdcf791c1153ba90ea3574a Mon Sep 17 00:00:00 2001 From: Guillaume DE OLIVEIRA Date: Thu, 28 Aug 2025 11:07:10 +0200 Subject: [PATCH 2/6] feedback + build image --- 4.4.8/Dockerfile.datahub-plugin | 22 +++++----------------- 4.4.8/README.md | 7 +++++++ 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/4.4.8/Dockerfile.datahub-plugin b/4.4.8/Dockerfile.datahub-plugin index 0d92906..379b245 100644 --- a/4.4.8/Dockerfile.datahub-plugin +++ b/4.4.8/Dockerfile.datahub-plugin @@ -1,21 +1,9 @@ -# Use the official GeoNetwork v4.4.8 image as the base FROM geonetwork:4.4.8 -ARG GEONETWORK_VERSION=4.4.8 -ARG PLUGIN_VERSION=${GEONETWORK_VERSION} -ARG PLUGIN_DOWNLOAD_URL="https://sourceforge.net/projects/geonetwork/files/GeoNetwork_opensource/v${GEONETWORK_VERSION}/gn-datahub-integration-${PLUGIN_VERSION}-0.zip/download" +ARG GN_VERSION=4.4.8 +ARG PLUGIN_DOWNLOAD_URL="https://sourceforge.net/projects/geonetwork/files/GeoNetwork_opensource/v${GN_VERSION}/gn-datahub-integration-${GN_VERSION}-0.zip/download" -USER root - -RUN apt-get update && \ - apt-get install -y \ - wget \ - unzip && \ - rm -rf /var/lib/apt/lists/* - -USER jetty - -RUN wget -O /tmp/gn-plugin-datahub-integration.zip ${PLUGIN_DOWNLOAD_URL} \ +RUN curl -fSL -o /tmp/gn-plugin-datahub-integration.zip ${PLUGIN_DOWNLOAD_URL} \ && unzip /tmp/gn-plugin-datahub-integration.zip -d /tmp/plugin \ - && cp /tmp/plugin/gn-datahub-integration-${PLUGIN_VERSION}-0/lib/*.jar /opt/geonetwork/WEB-INF/lib/ \ - && rm -rf /tmp/plugin /tmp/gn-plugin-datahub-integration.zip \ No newline at end of file + && cp /tmp/plugin/gn-datahub-integration-${GN_VERSION}-0/lib/*.jar /opt/geonetwork/WEB-INF/lib/ \ + && rm -rf /tmp/plugin /tmp/gn-plugin-datahub-integration.zip diff --git a/4.4.8/README.md b/4.4.8/README.md index e0ad754..d7c85cc 100644 --- a/4.4.8/README.md +++ b/4.4.8/README.md @@ -26,6 +26,13 @@ If not published, you can build the image locally using: docker build . -t geonetwork:4.4.8 ``` +## Build datahub docker image +If not published, you can build the image locally using: + +```shell script +docker build -t geonetwork-datahub:4.4.8 -f Dockerfile.datahub-plugin . +``` + ## Running with custom geonetwork.war From b7d1011f9429a9e5d27443750ee10216a6c0504a Mon Sep 17 00:00:00 2001 From: Guillaume DE OLIVEIRA Date: Thu, 28 Aug 2025 16:08:29 +0200 Subject: [PATCH 3/6] init Github worklow pushing docker image --- simplified-workflow-dual.yml | 147 +++++++++++++++++++++++++++++++++++ 1 file changed, 147 insertions(+) create mode 100644 simplified-workflow-dual.yml diff --git a/simplified-workflow-dual.yml b/simplified-workflow-dual.yml new file mode 100644 index 0000000..44f648b --- /dev/null +++ b/simplified-workflow-dual.yml @@ -0,0 +1,147 @@ +name: GeoNetwork DataHub Plugin Release + +on: + workflow_dispatch: + inputs: + version: + description: 'GeoNetwork version (e.g., 4.4.8)' + required: true + type: string + use_latest: + description: 'Also tag this image as latest (true/false)' + default: 'false' + required: false + type: boolean + +env: + REGISTRY: docker.io + IMAGE_NAME: geonetwork + +jobs: + build-standard-image: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + outputs: + version: ${{ env.VERSION }} + use_latest: ${{ env.USE_LATEST }} + built: ${{ steps.build-push.outputs.digest != '' }} + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set version + id: set-version + run: | + VERSION="${{ github.event.inputs.version }}" + USE_LATEST="${{ github.event.inputs.use_latest }}" + + echo "VERSION=$VERSION" >> $GITHUB_ENV + echo "USE_LATEST=$USE_LATEST" >> $GITHUB_ENV + + - name: Check if standard Dockerfile exists + id: check-standard-dockerfile + run: | + if [[ ! -d "$VERSION" ]]; then + echo "Error: Version directory $VERSION does not exist." + exit 1 + fi + + if [[ ! -f "$VERSION/Dockerfile" ]]; then + echo "Error: Standard Dockerfile does not exist for version $VERSION." + exit 1 + else + echo "Standard Dockerfile found for version $VERSION." + fi + + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_PASSWORD }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Prepare standard tags + id: prepare-standard-tags + run: | + TAGS="${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }}" + + if [[ "${{ env.USE_LATEST }}" == "true" ]]; then + TAGS="$TAGS,${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest" + fi + + echo "tags=$TAGS" >> $GITHUB_OUTPUT + + - name: Build and push standard Docker image + id: build-push + uses: docker/build-push-action@v5 + with: + context: ./${{ env.VERSION }} + file: ./${{ env.VERSION }}/Dockerfile + push: true + tags: ${{ steps.prepare-standard-tags.outputs.tags }} + + build-datahub-image: + needs: build-standard-image + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + if: success() && needs.build-standard-image.outputs.built == 'true' + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set version from previous job + run: | + echo "VERSION=${{ needs.build-standard-image.outputs.version }}" >> $GITHUB_ENV + echo "USE_LATEST=${{ needs.build-standard-image.outputs.use_latest }}" >> $GITHUB_ENV + + - name: Check if DataHub Dockerfile exists + id: check-datahub-dockerfile + run: | + if [[ -f "$VERSION/Dockerfile.datahub-plugin" ]]; then + echo "DATAHUB_EXISTS=true" >> $GITHUB_ENV + echo "DataHub Dockerfile found for version $VERSION." + else + echo "DATAHUB_EXISTS=false" >> $GITHUB_ENV + echo "DataHub Dockerfile not found for version $VERSION. Will skip DataHub build." + exit 0 + fi + + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_PASSWORD }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Prepare DataHub tags + id: prepare-datahub-tags + if: env.DATAHUB_EXISTS == 'true' + run: | + TAGS="${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-datahub:${{ env.VERSION }}" + + if [[ "${{ env.USE_LATEST }}" == "true" ]]; then + TAGS="$TAGS,${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-datahub:latest" + fi + + echo "tags=$TAGS" >> $GITHUB_OUTPUT + + - name: Build and push DataHub Docker image + uses: docker/build-push-action@v5 + if: env.DATAHUB_EXISTS == 'true' + with: + context: ./${{ env.VERSION }} + file: ./${{ env.VERSION }}/Dockerfile.datahub-plugin + push: true + tags: ${{ steps.prepare-datahub-tags.outputs.tags }} From 96a4473554716f6d19b4b1729d3c9eea5f3a50b6 Mon Sep 17 00:00:00 2001 From: Guillaume DE OLIVEIRA Date: Thu, 28 Aug 2025 16:09:32 +0200 Subject: [PATCH 4/6] move file --- .../workflows/push-docker-image.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename simplified-workflow-dual.yml => .github/workflows/push-docker-image.yml (100%) diff --git a/simplified-workflow-dual.yml b/.github/workflows/push-docker-image.yml similarity index 100% rename from simplified-workflow-dual.yml rename to .github/workflows/push-docker-image.yml From 87231e9b77af611eb42d1a3b05c608c3ab874a53 Mon Sep 17 00:00:00 2001 From: Guillaume DE OLIVEIRA Date: Thu, 28 Aug 2025 16:13:40 +0200 Subject: [PATCH 5/6] MD5 for plugin --- 4.4.8/Dockerfile.datahub-plugin | 2 ++ 1 file changed, 2 insertions(+) diff --git a/4.4.8/Dockerfile.datahub-plugin b/4.4.8/Dockerfile.datahub-plugin index 379b245..662c9b0 100644 --- a/4.4.8/Dockerfile.datahub-plugin +++ b/4.4.8/Dockerfile.datahub-plugin @@ -2,8 +2,10 @@ FROM geonetwork:4.4.8 ARG GN_VERSION=4.4.8 ARG PLUGIN_DOWNLOAD_URL="https://sourceforge.net/projects/geonetwork/files/GeoNetwork_opensource/v${GN_VERSION}/gn-datahub-integration-${GN_VERSION}-0.zip/download" +ARG PLUGIN_MD5="2a94adb2c674ada4dec048495163d22c" RUN curl -fSL -o /tmp/gn-plugin-datahub-integration.zip ${PLUGIN_DOWNLOAD_URL} \ + && echo "${PLUGIN_MD5} /tmp/gn-plugin-datahub-integration.zip" | md5sum -c - \ && unzip /tmp/gn-plugin-datahub-integration.zip -d /tmp/plugin \ && cp /tmp/plugin/gn-datahub-integration-${GN_VERSION}-0/lib/*.jar /opt/geonetwork/WEB-INF/lib/ \ && rm -rf /tmp/plugin /tmp/gn-plugin-datahub-integration.zip From 713e55d9ada21032814db90613b5e7a1cd0e598a Mon Sep 17 00:00:00 2001 From: Guillaume DE OLIVEIRA Date: Thu, 28 Aug 2025 16:24:53 +0200 Subject: [PATCH 6/6] latest docker versions --- .github/workflows/push-docker-image.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/push-docker-image.yml b/.github/workflows/push-docker-image.yml index 44f648b..d027549 100644 --- a/.github/workflows/push-docker-image.yml +++ b/.github/workflows/push-docker-image.yml @@ -30,7 +30,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Set version id: set-version @@ -79,7 +79,7 @@ jobs: - name: Build and push standard Docker image id: build-push - uses: docker/build-push-action@v5 + uses: docker/build-push-action@v6 with: context: ./${{ env.VERSION }} file: ./${{ env.VERSION }}/Dockerfile @@ -138,7 +138,7 @@ jobs: echo "tags=$TAGS" >> $GITHUB_OUTPUT - name: Build and push DataHub Docker image - uses: docker/build-push-action@v5 + uses: docker/build-push-action@v6 if: env.DATAHUB_EXISTS == 'true' with: context: ./${{ env.VERSION }}