|
| 1 | +name: Containers |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - main |
| 6 | + tags: |
| 7 | + - "v*" |
| 8 | + pull_request: |
| 9 | + branches: |
| 10 | + - main |
| 11 | + |
| 12 | +jobs: |
| 13 | + # Honu Image Build |
| 14 | + honu: |
| 15 | + name: Honu |
| 16 | + runs-on: ubuntu-latest |
| 17 | + steps: |
| 18 | + - name: Checkout Code |
| 19 | + uses: actions/checkout@v4 |
| 20 | + |
| 21 | + - name: Set Environment |
| 22 | + id: vars |
| 23 | + run: | |
| 24 | + echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT |
| 25 | + echo "revision=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT |
| 26 | +
|
| 27 | + - name: Docker Metadata |
| 28 | + id: meta |
| 29 | + uses: docker/metadata-action@v5 |
| 30 | + with: |
| 31 | + # list of Docker images to use as basenames for tags |
| 32 | + # this should be configured for each container built |
| 33 | + images: | |
| 34 | + rotationalio/honu |
| 35 | + gcr.io/rotationalio-habanero/honu |
| 36 | + tags: | |
| 37 | + type=semver,pattern={{raw}} |
| 38 | + type=semver,pattern={{version}} |
| 39 | + type=semver,pattern={{major}}.{{minor}} |
| 40 | + type=sha,prefix=,suffix=,format=short |
| 41 | +
|
| 42 | + - name: Setup QEMU |
| 43 | + uses: docker/setup-qemu-action@v3 |
| 44 | + |
| 45 | + - name: Setup Docker Buildx |
| 46 | + id: buildx |
| 47 | + uses: docker/setup-buildx-action@v3 |
| 48 | + |
| 49 | + - name: Login to DockerHub |
| 50 | + if: github.event_name != 'pull_request' |
| 51 | + uses: docker/login-action@v3 |
| 52 | + with: |
| 53 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 54 | + password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }} |
| 55 | + |
| 56 | + - name: Login to GCR |
| 57 | + if: github.event_name != 'pull_request' |
| 58 | + uses: docker/login-action@v3 |
| 59 | + with: |
| 60 | + registry: gcr.io |
| 61 | + username: _json_key |
| 62 | + password: ${{ secrets.GCR_SERVICE_ACCOUNT }} |
| 63 | + |
| 64 | + - name: Build and push |
| 65 | + id: docker_build |
| 66 | + uses: docker/build-push-action@v5 |
| 67 | + with: |
| 68 | + context: . |
| 69 | + file: ./Dockerfile |
| 70 | + push: ${{ github.event_name != 'pull_request' }} |
| 71 | + tags: ${{ steps.meta.outputs.tags }} |
| 72 | + labels: ${{ steps.meta.outputs.labels }} |
| 73 | + platforms: linux/amd64,linux/arm64 |
| 74 | + build-args: | |
| 75 | + GIT_REVISION=${{ steps.vars.outputs.revision }} |
0 commit comments