blob: e066084b9310da00db2f2efbba48ae43e9d396b5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
# 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-20.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v2
with:
image: tonistiigi/binfmt:latest
platforms: linux/amd64,linux/arm64
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}
- name: Cache Docker layers
uses: actions/cache@v3.2.1
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
platforms: linux/amd64,linux/arm64
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
|