-
Notifications
You must be signed in to change notification settings - Fork 170
74 lines (65 loc) · 2.72 KB
/
master-latest.yaml
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
70
71
72
73
74
name: master-latest
on:
push:
branches: [ master ]
jobs:
multiarch-to-dockerhub-latest:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
# We use buildx instead of regular build so we can take advantage of Docker layer cache via GithubActions' cache
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
# Setup the Github Actions cache.
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildxarch-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildxarch-
- name: Docker Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Docker Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }} # github username or org
password: ${{ secrets.GITHUB_TOKEN }} # github actions builtin token. repo has to have pkg access.
# the arm64 is of course much slower due to qemu, so build and push amd64 **first**
# due to the way manifests work, the gap between this and the complete push below
# could result in pull failures or inconsistencies for arm64, such is life.
# further duplicated by building both release and debug builds
- name: Build and push amd64 Release Docker Image to DockerHub/GitHub CR
uses: docker/build-push-action@v2
with:
build-args: |
DEBUG_BUILD=0
BASE_IMAGE_SUFFIX=
builder: ${{ steps.buildx.outputs.name }}
context: .
file: ./Dockerfile
platforms: linux/amd64
tags: rpardini/docker-registry-proxy:latest,ghcr.io/rpardini/docker-registry-proxy:latest
push: true
cache-from: type=local,src=/tmp/.buildx-cache/release
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache/release
- name: Build and push amd64 Debug Docker Image to DockerHub/GitHub CR
uses: docker/build-push-action@v2
with:
build-args: |
DEBUG_BUILD=1
BASE_IMAGE_SUFFIX=-debug
builder: ${{ steps.buildx.outputs.name }}
context: .
file: ./Dockerfile
platforms: linux/amd64
tags: rpardini/docker-registry-proxy:latest-debug,ghcr.io/rpardini/docker-registry-proxy:latest-debug
push: true
cache-from: type=local,src=/tmp/.buildx-cache/debug
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache/debug