diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml new file mode 100644 index 000000000000..e92dcf24d962 --- /dev/null +++ b/.github/workflows/docker-build.yml @@ -0,0 +1,46 @@ +name: Docker Build + +on: + workflow_run: + workflows: ["Linux GitHub CI"] + types: + - completed + +jobs: + build-docker: + if: > + github.event.workflow_run.conclusion == 'success' && + (github.event.workflow_run.head_branch == 'main' || github.event.workflow_run.head_branch == 'ghaction-docker') + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + # The checkout action is required to access the repository files, + # including the Dockerfile. + # It needs to checkout the specific commit that triggered the 'Linux GitHub CI' workflow. + - name: Checkout repository + uses: actions/checkout@v4 + with: + ref: ${{ github.event.workflow_run.head_sha }} + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + file: ./docker/gn-image/Dockerfile + push: true + tags: ghcr.io/${{ github.repository }}/geonetwork:${{ github.event.workflow_run.head_branch }} diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 69a6f03c0818..6442cf2977f5 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -22,7 +22,7 @@ jobs: submodules: 'recursive' show-progress: 'false' - name: Set up JDK - uses: actions/setup-java@v4.2.1 + uses: actions/setup-java@v5 with: distribution: 'temurin' java-version: ${{ matrix.jdk }} @@ -55,7 +55,7 @@ jobs: submodules: 'recursive' show-progress: 'false' - name: Set up JDK - uses: actions/setup-java@v4.2.1 + uses: actions/setup-java@v5 with: distribution: 'temurin' java-version: 11 @@ -67,7 +67,7 @@ jobs: - name: Test with maven run: | mvn -B resources:resources@copy-index-schema-to-source -f web - mvn -B -ntp -V -fae verify -Drelesae -Pit + mvn -B -ntp -V -fae verify -Drelease -Pit - name: Check for uncommitted changes such as formatting changes run: | if [[ -n "$(git status -s)" ]]; then diff --git a/.gitignore b/.gitignore index c29048710e84..aeb498869e2d 100644 --- a/.gitignore +++ b/.gitignore @@ -46,6 +46,7 @@ transifex/transifex-format/ build/ web-ui/LICENSE web-ui/tx +plugins/datahub-integration/node/ # web-app, clear using: mvn -f web/pom.xml clean:clean@reset diff --git a/docker/gn-image/Dockerfile b/docker/gn-image/Dockerfile new file mode 100644 index 000000000000..77e5123ec946 --- /dev/null +++ b/docker/gn-image/Dockerfile @@ -0,0 +1,20 @@ +# Build stage +FROM maven:3.8-jdk-11 AS builder + +WORKDIR /usr/src/geonetwork + +# Copy the entire project +COPY . . + +# Build the project and create the WAR file +# The command is taken from the release-build.sh script +RUN mvn clean install -DskipTests -ntp -Pwar -Pwro4j-prebuild-cache + +# Runtime stage +FROM jetty:9-jre11 + +# The geonetwork.war file is in web/target/ +COPY --from=builder /usr/src/geonetwork/web/target/geonetwork.war /var/lib/jetty/webapps/geonetwork.war + +# Expose the default Jetty port +EXPOSE 8080