mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Tobias Gesellchen
30.06.2022 2ddf6516136060b5dfa6eefbd93aed3168c83e0f
.github/workflows/build.yml
@@ -15,7 +15,7 @@
        java: [ '8', '11']
        os: [ 'ubuntu-latest', 'macos-latest', 'windows-latest' ]
    steps:
    - name:  Install wine+rpm for ditribution
    - name:  Install wine+rpm for distribution
      if: runner.os == 'Linux'
      shell: bash
      run:   |
@@ -45,21 +45,6 @@
      env:
        MAVEN_OPTS: -Dhttps.protocols=TLSv1.2 -Dmaven.wagon.httpconnectionManager.ttlSeconds=120 -Dmaven.wagon.http.retryHandler.requestSentEnabled=true -Dmaven.wagon.http.retryHandler.count=10
      run: mvn --batch-mode --errors --update-snapshots package --file pom.xml
    - name: Docker build
      if: runner.os == 'Linux'
      shell: bash
      run:   |
         git fetch -t; export git_version_last="$(git describe --abbrev=0 --tags)" ; echo "last release: $git_version_last"
         docker build opendj-packages/opendj-docker -f opendj-packages/opendj-docker/Dockerfile -t ${GITHUB_REPOSITORY,,}:$git_version_last --build-arg VERSION=$git_version_last
         docker build opendj-packages/opendj-docker -f opendj-packages/opendj-docker/Dockerfile-alpine -t ${GITHUB_REPOSITORY,,}:$git_version_last-alpine --build-arg VERSION=$git_version_last
    - name: Docker test
      if: runner.os == 'Linux'
      shell: bash
      run:   |
         git fetch -t; export git_version_last="$(git describe --abbrev=0 --tags)" ; echo "last release: $git_version_last, docker image: ${GITHUB_REPOSITORY,,}:$git_version_last"
         docker run --rm -it -d --name=opendj_1  --health-cmd='/opt/opendj/bin/ldapsearch --hostname localhost --port 1636 --bindDN "cn=Directory Manager" --bindPassword password --useSsl --trustAll --baseDN "" --searchScope base "(objectClass=*)" 1.1 || /opt/opendj/bin/stop-ds || exit 1'  --health-retries=10 --health-timeout=10s ${GITHUB_REPOSITORY,,}:$git_version_last
         timeout 3m bash -c 'until docker inspect --format="{{json .State.Health.Status}}" opendj_1 | grep -q \"healthy\"; do sleep 10; done'
         docker stop opendj_1 || true
    - name: Upload artifacts OpenDJ Server
      uses: actions/upload-artifact@v3
      with:
@@ -76,3 +61,77 @@
            opendj-doc-generated-ref/target/*.zip
            opendj-dsml-servlet/target/*.war
            opendj-rest2ldap-servlet/target/*.war
  build-docker:
    name: Docker build
    runs-on: 'ubuntu-latest'
    services:
      registry:
        image: registry:2
        ports:
          - 5000:5000
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0
          submodules: recursive
      - name: Get latest release version
        shell: bash
        run:   |
          git fetch -t; export git_version_last="$(git describe --abbrev=0 --tags)" ; echo "last release: $git_version_last"
          echo "release_version=$git_version_last" >> $GITHUB_ENV
      - name: Docker meta (default)
        id: meta
        uses: docker/metadata-action@v3
        with:
          images: |
            localhost:5000/${{ github.repository }}
          tags: |
            type=raw,value=latest
            type=raw,value=${{ env.release_version }}
      - name: Docker meta (alpine)
        id: meta_alpine
        uses: docker/metadata-action@v3
        with:
          images: |
            localhost:5000/${{ github.repository }}
          tags: |
            type=raw,value=alpine
            type=raw,value=${{ env.release_version }}-alpine
      - name: Set up QEMU
        uses: docker/setup-qemu-action@v1
      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v1
        with:
          driver-opts: network=host
      - name: Build image (default)
        uses: docker/build-push-action@v2
        continue-on-error: true
        with:
          context: ./opendj-packages/opendj-docker
          file: ./opendj-packages/opendj-docker/Dockerfile
          build-args: |
            VERSION=${{ env.release_version }}
          platforms: linux/amd64,linux/arm64/8
          push: true
          tags: ${{ steps.meta.outputs.tags }}
          labels: ${{ steps.meta.outputs.labels }}
      - name: Build image (alpine)
        continue-on-error: true
        uses: docker/build-push-action@v2
        with:
          context: ./opendj-packages/opendj-docker
          file: ./opendj-packages/opendj-docker/Dockerfile-alpine
          build-args: |
            VERSION=${{ env.release_version }}
          platforms: linux/amd64,linux/arm64/8
          push: true
          tags: ${{ steps.meta_alpine.outputs.tags }}
          labels: ${{ steps.meta_alpine.outputs.labels }}
      - name: Docker test
        shell: bash
        run: |
          export docker_image="localhost:5000/${GITHUB_REPOSITORY,,}:${{ env.release_version }}"
          echo "last release: ${{ env.release_version }}, docker image: ${docker_image}"
          docker run --rm -it -d --name=opendj_1 --health-cmd='/opt/opendj/bin/ldapsearch --hostname localhost --port 1636 --bindDN "cn=Directory Manager" --bindPassword password --useSsl --trustAll --baseDN "" --searchScope base "(objectClass=*)" 1.1 || /opt/opendj/bin/stop-ds || exit 1'  --health-retries=10 --health-timeout=10s ${docker_image}
          timeout 3m bash -c 'until docker inspect --format="{{json .State.Health.Status}}" opendj_1 | grep -q \"healthy\"; do sleep 10; done'
          docker stop opendj_1 || true