|
6 | 6 | dockerhub-username:
|
7 | 7 | required: true
|
8 | 8 | type: string
|
| 9 | + # this workflow publishes a rocksdb & goleveldb docker images with these tags: |
| 10 | + # - <commit-hash>-goleveldb |
| 11 | + # - <extra-image-tag>-goleveldb |
| 12 | + # - <commit-hash>-rocksdb |
| 13 | + # - <extra-image-tag>-rocksdb |
| 14 | + extra-image-tag: |
| 15 | + required: true |
| 16 | + type: string |
9 | 17 | secrets:
|
10 | 18 | CI_DOCKERHUB_TOKEN:
|
11 | 19 | required: true
|
|
14 | 22 | # you can use images built by this action in future jobs.
|
15 | 23 | # https://docs.docker.com/build/ci/github-actions/examples/#share-built-image-between-jobs
|
16 | 24 | jobs:
|
17 |
| - docker: |
| 25 | + docker-goleveldb: |
| 26 | + # https://github.com/marketplace/actions/build-and-push-docker-images |
| 27 | + runs-on: ubuntu-latest |
| 28 | + steps: |
| 29 | + # ensure working with latest code |
| 30 | + - name: Checkout |
| 31 | + uses: actions/checkout@v4 |
| 32 | + |
| 33 | + # generate a git commit hash to be used as image tag |
| 34 | + - name: Generate short hash |
| 35 | + id: commit-hash |
| 36 | + run: echo "short=$( git rev-parse --short $GITHUB_SHA )" >> $GITHUB_OUTPUT |
| 37 | + |
| 38 | + # qemu is used to emulate different platform architectures |
| 39 | + - name: Set up QEMU |
| 40 | + uses: docker/setup-qemu-action@v3 |
| 41 | + |
| 42 | + # cross-platform build of the image |
| 43 | + - name: Set up Docker Buildx |
| 44 | + uses: docker/setup-buildx-action@v3 |
| 45 | + |
| 46 | + # authenticate for publish to docker hub |
| 47 | + - name: Login to Docker Hub |
| 48 | + uses: docker/login-action@v3 |
| 49 | + with: |
| 50 | + username: ${{ inputs.dockerhub-username }} |
| 51 | + password: ${{ secrets.CI_DOCKERHUB_TOKEN }} |
| 52 | + |
| 53 | + # publish to docker hub, tag with short git hash |
| 54 | + - name: Build and push (goleveldb) |
| 55 | + uses: docker/build-push-action@v5 |
| 56 | + with: |
| 57 | + context: . |
| 58 | + cache-from: type=gha |
| 59 | + cache-to: type=gha,mode=max |
| 60 | + platforms: linux/amd64,linux/arm64 |
| 61 | + push: true |
| 62 | + tags: kava/kava:${{ steps.commit-hash.outputs.short }}-goleveldb,kava/kava:${{ inputs.extra-image-tag }}-goleveldb |
| 63 | + |
| 64 | + docker-rocksdb: |
18 | 65 | # https://github.com/marketplace/actions/build-and-push-docker-images
|
19 | 66 | runs-on: ubuntu-latest
|
20 | 67 | steps:
|
21 | 68 | # ensure working with latest code
|
22 | 69 | - name: Checkout
|
23 |
| - uses: actions/checkout@v3 |
| 70 | + uses: actions/checkout@v4 |
| 71 | + |
24 | 72 | # generate a git commit hash to be used as image tag
|
25 | 73 | - name: Generate short hash
|
26 | 74 | id: commit-hash
|
27 | 75 | run: echo "short=$( git rev-parse --short $GITHUB_SHA )" >> $GITHUB_OUTPUT
|
| 76 | + |
28 | 77 | # qemu is used to emulate different platform architectures
|
29 | 78 | - name: Set up QEMU
|
30 |
| - uses: docker/setup-qemu-action@v2 |
| 79 | + uses: docker/setup-qemu-action@v3 |
| 80 | + |
31 | 81 | # cross-platform build of the image
|
32 | 82 | - name: Set up Docker Buildx
|
33 |
| - uses: docker/setup-buildx-action@v2 |
| 83 | + uses: docker/setup-buildx-action@v3 |
| 84 | + |
34 | 85 | # authenticate for publish to docker hub
|
35 | 86 | - name: Login to Docker Hub
|
36 |
| - uses: docker/login-action@v2 |
| 87 | + uses: docker/login-action@v3 |
37 | 88 | with:
|
38 | 89 | username: ${{ inputs.dockerhub-username }}
|
39 | 90 | password: ${{ secrets.CI_DOCKERHUB_TOKEN }}
|
| 91 | + |
40 | 92 | # publish to docker hub, tag with short git hash
|
41 |
| - - name: Build and push |
42 |
| - uses: docker/build-push-action@v3 |
| 93 | + - name: Build and push (rocksdb) |
| 94 | + uses: docker/build-push-action@v5 |
43 | 95 | with:
|
44 | 96 | context: .
|
| 97 | + file: Dockerfile-rocksdb |
| 98 | + cache-from: type=gha |
| 99 | + cache-to: type=gha,mode=max |
45 | 100 | platforms: linux/amd64,linux/arm64
|
46 | 101 | push: true
|
47 |
| - tags: kava/kava:${{ steps.commit-hash.outputs.short }},kava/kava:master |
| 102 | + tags: kava/kava:${{ steps.commit-hash.outputs.short }}-rocksdb,kava/kava:${{ inputs.extra-image-tag }}-rocksdb |
0 commit comments