diff options
Diffstat (limited to '.github/workflows/oci-base.yaml')
-rw-r--r-- | .github/workflows/oci-base.yaml | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/.github/workflows/oci-base.yaml b/.github/workflows/oci-base.yaml new file mode 100644 index 0000000000..93f3576f7c --- /dev/null +++ b/.github/workflows/oci-base.yaml @@ -0,0 +1,58 @@ +# https://github.com/marketplace/actions/build-and-push-docker-images +name: OCI Base Image +on: + schedule: + - cron: '0 3 * * *' + workflow_dispatch: +jobs: + build-publish: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Cache Docker layers + uses: actions/cache@v3.0.5 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-${{ matrix.image_tag_suffix }}-buildx-${{ github.event.pull_request.head.sha || github.sha }} + restore-keys: | + ${{ runner.os }}-${{ matrix.image_tag_suffix }}-buildx- + + - name: Check for Push Credentials + id: authorized + run: | + if [ -n "${{ secrets.DOCKERHUB_USERNAME }}" ]; then + echo "::set-output name=PUSH::true" + else + echo "::set-output name=PUSH::false" + fi + + - name: Login to DockerHub + if: steps.authorized.outputs.PUSH == 'true' + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_PASSWORD }} + + - name: Build and push + uses: docker/build-push-action@v2 + with: + context: packaging/base-image + pull: true + push: ${{ steps.authorized.outputs.PUSH }} + tags: | + pivotalrabbitmq/ubuntu:20.04 + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache-new + + # Temp fix + # https://github.com/docker/build-push-action/issues/252 + # https://github.com/moby/buildkit/issues/1896 + - name: Move cache + run: | + rm -rf /tmp/.buildx-cache + mv /tmp/.buildx-cache-new /tmp/.buildx-cache |