2020-10-07 23:57:49 +00:00
|
|
|
name: master-latest
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches: [ master ]
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
multiarch-to-dockerhub-latest:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
2020-10-08 13:37:41 +00:00
|
|
|
# We use buildx instead of regular build so we can take advantage of Docker layer cache via GithubActions' cache
|
2020-10-07 23:57:49 +00:00
|
|
|
- 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-
|
|
|
|
|
2020-10-30 11:56:22 +00:00
|
|
|
- name: Docker Login to DockerHub
|
2020-10-07 23:57:49 +00:00
|
|
|
uses: docker/login-action@v1
|
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
|
|
|
|
|
2020-10-30 11:56:22 +00:00
|
|
|
- name: Docker Login to GitHub Container Registry
|
|
|
|
uses: docker/login-action@v1
|
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ secrets.DOCKER_GITHUB_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKER_GITHUB_PAT }}
|
|
|
|
|
2020-10-07 23:57:49 +00:00
|
|
|
# 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
|
2020-10-30 12:09:27 +00:00
|
|
|
- name: Build and push amd64 Release Docker Image to DockerHub/GitHub CR
|
2020-10-07 23:57:49 +00:00
|
|
|
uses: docker/build-push-action@v2
|
|
|
|
with:
|
2020-10-29 23:41:13 +00:00
|
|
|
build-args: |
|
|
|
|
DEBUG_BUILD=0
|
|
|
|
BASE_IMAGE_SUFFIX=
|
2020-10-07 23:57:49 +00:00
|
|
|
builder: ${{ steps.buildx.outputs.name }}
|
|
|
|
context: .
|
|
|
|
file: ./Dockerfile
|
|
|
|
platforms: linux/amd64
|
2021-03-30 08:07:56 +00:00
|
|
|
tags: sktdev/docker-registry-proxy:latest,ghcr.io/openinfradev/docker-registry-proxy:latest
|
2020-10-07 23:57:49 +00:00
|
|
|
push: true
|
|
|
|
cache-from: type=local,src=/tmp/.buildx-cache/release
|
2020-10-08 13:37:41 +00:00
|
|
|
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache/release
|
2020-10-07 23:57:49 +00:00
|
|
|
|
2020-10-30 12:09:27 +00:00
|
|
|
- name: Build and push amd64 Debug Docker Image to DockerHub/GitHub CR
|
2020-10-07 23:57:49 +00:00
|
|
|
uses: docker/build-push-action@v2
|
|
|
|
with:
|
2020-10-29 23:41:13 +00:00
|
|
|
build-args: |
|
|
|
|
DEBUG_BUILD=1
|
|
|
|
BASE_IMAGE_SUFFIX=-debug
|
2020-10-07 23:57:49 +00:00
|
|
|
builder: ${{ steps.buildx.outputs.name }}
|
|
|
|
context: .
|
|
|
|
file: ./Dockerfile
|
|
|
|
platforms: linux/amd64
|
2021-03-30 08:07:56 +00:00
|
|
|
tags: sktdev/docker-registry-proxy:latest-debug,ghcr.io/openinfradev/docker-registry-proxy:latest-debug
|
2020-10-07 23:57:49 +00:00
|
|
|
push: true
|
|
|
|
cache-from: type=local,src=/tmp/.buildx-cache/debug
|
|
|
|
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache/debug
|