|
| 1 | +name: Build Z3FDB Web Service Container |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - develop |
| 8 | + tags: |
| 9 | + - '[0-9]+.[0-9]+.[0-9]+' |
| 10 | + pull_request: |
| 11 | + |
| 12 | +env: |
| 13 | + REGISTRY: eccr.ecmwf.int |
| 14 | + IMAGE_NAME: z3fdb-web-service |
| 15 | + PROJECT_NAME: kkratz |
| 16 | + |
| 17 | +jobs: |
| 18 | + build-packages: |
| 19 | + name: Build Packages |
| 20 | + runs-on: [self-hosted, Linux, platform-builder-docker] |
| 21 | + container: |
| 22 | + image: eccr.ecmwf.int/ci-utils/ubuntu_rolling_fdb_build_env:latest |
| 23 | + credentials: |
| 24 | + username: ${{ secrets.ECMWF_DOCKER_REGISTRY_USERNAME }} |
| 25 | + password: ${{ secrets.ECMWF_DOCKER_REGISTRY_ACCESS_TOKEN }} |
| 26 | + steps: |
| 27 | + - name: Get ecbuild |
| 28 | + uses: actions/checkout@v5 |
| 29 | + with: |
| 30 | + repository: ecmwf/ecbuild |
| 31 | + ref: develop |
| 32 | + path: ecbuild |
| 33 | + - name: Get cxx-dependencies |
| 34 | + uses: actions/checkout@v5 |
| 35 | + with: |
| 36 | + repository: ecmwf/cxx-dependencies |
| 37 | + ref: master |
| 38 | + path: cxx-dependencies |
| 39 | + token: ${{ secrets.GH_REPO_READ_TOKEN }} |
| 40 | + submodules: recursive |
| 41 | + - name: Get eccodes |
| 42 | + uses: actions/checkout@v5 |
| 43 | + with: |
| 44 | + repository: ecmwf/eccodes |
| 45 | + ref: develop |
| 46 | + path: eccodes |
| 47 | + - name: Get eckit |
| 48 | + uses: actions/checkout@v5 |
| 49 | + with: |
| 50 | + repository: ecmwf/eckit |
| 51 | + ref: develop |
| 52 | + path: eckit |
| 53 | + - name: Get metkit |
| 54 | + uses: actions/checkout@v5 |
| 55 | + with: |
| 56 | + repository: ecmwf/metkit |
| 57 | + ref: develop |
| 58 | + path: metkit |
| 59 | + - name: Get fdb5 |
| 60 | + uses: actions/checkout@v5 |
| 61 | + with: |
| 62 | + repository: ecmwf/fdb |
| 63 | + path: fdb |
| 64 | + - name: Compile, test and pack |
| 65 | + run: | |
| 66 | + ./fdb/containerfiles/z3fdb_web_service/build_contents.sh |
| 67 | + rm -rf stage |
| 68 | + mkdir stage |
| 69 | + mv *.zst *.whl stage |
| 70 | + - name: Upload stage archive |
| 71 | + uses: actions/upload-artifact@v4 |
| 72 | + with: |
| 73 | + name: stage |
| 74 | + path: stage/ |
| 75 | + |
| 76 | + |
| 77 | + build-container: |
| 78 | + name: Build Image |
| 79 | + runs-on: [self-hosted, Linux, platform-builder-docker] |
| 80 | + needs: [build-packages] |
| 81 | + steps: |
| 82 | + - name: Get fdb5 |
| 83 | + uses: actions/checkout@v5 |
| 84 | + with: |
| 85 | + repository: ecmwf/fdb |
| 86 | + - name: Download stage archive |
| 87 | + uses: actions/download-artifact@v4 |
| 88 | + with: |
| 89 | + name: stage |
| 90 | + path: stage/ |
| 91 | + - name: Log in to ECCR |
| 92 | + uses: docker/login-action@v3 |
| 93 | + with: |
| 94 | + registry: ${{ env.REGISTRY }} |
| 95 | + username: ${{ secrets.KKRATZ_ECCR_USER }} |
| 96 | + password: ${{ secrets.KKRATZ_ECCR_TOKEN }} |
| 97 | + - name: Extract metadata (tags, labels) |
| 98 | + id: meta |
| 99 | + uses: docker/metadata-action@v5 |
| 100 | + with: |
| 101 | + images: ${{ env.REGISTRY }}/${{ env.PROJECT_NAME }}/${{ env.IMAGE_NAME }} |
| 102 | + tags: | |
| 103 | + # SHA tag for all builds |
| 104 | + type=sha |
| 105 | + # Semver tag: use git tag as-is (e.g., 1.2.3) |
| 106 | + type=semver,pattern={{version}} |
| 107 | + # latest tag only for semver releases |
| 108 | + type=raw,value=latest,enable=${{ github.ref_type == 'tag' }} |
| 109 | + # latest-develop for develop branch |
| 110 | + type=raw,value=latest-develop,enable=${{ github.ref == 'refs/heads/develop' }} |
| 111 | + # latest-pr-<number> for pull requests |
| 112 | + type=raw,value=latest-pr-${{ github.event.pull_request.number }},enable=${{ github.event_name == 'pull_request' }} |
| 113 | + # latest-manual for workflow_dispatch |
| 114 | + type=raw,value=latest-manual,enable=${{ github.event_name == 'workflow_dispatch' }} |
| 115 | + - name: Set up Docker Buildx |
| 116 | + uses: docker/setup-buildx-action@v3 |
| 117 | + - name: Build and push Docker image |
| 118 | + uses: docker/build-push-action@v5 |
| 119 | + with: |
| 120 | + context: ./stage |
| 121 | + file: ./containerfiles/z3fdb_web_service/Dockerfile |
| 122 | + push: true |
| 123 | + tags: ${{ steps.meta.outputs.tags }} |
0 commit comments