yolks/.github/workflows/docker-publish.yml
2020-12-15 09:54:04 -07:00

69 lines
1.9 KiB
YAML

name: Docker
on:
push:
branches:
- master
jobs:
push:
name: Push
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
image:
- "alpine"
#- "alpine-install"
#- "java7"
#- "java8"
#- "java9"
#- "java10"
#- "java11"
#- "java12"
#- "java13"
#- "java14"
#- "java15"
#- "source"
#- "source-install"
steps:
- name: Code Checkout
uses: actions/checkout@v2
- name: Install buildx
uses: docker/setup-buildx-action@v1
with:
version: v0.5.1
buildkitd-flags: --debug
# - name: Registry Authentication
# run: |
# echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin
# - name: Build Image
# env:
# IMAGE_ID: docker.pkg.github.com/${{ github.repository }}/${{ matrix.image }}:latest
# run: |
# docker buildx build --push --platform=linux/amd64 --tag=$IMAGE_ID ./${{ matrix.image }}
- name: Set up containerd
uses: crazy-max/ghaction-setup-containerd@v1
- name: Build Docker image
uses: docker/build-push-action@v2
with:
context: ./alpine
file: ./Dockerfile
platforms: linux/amd64
tags: docker.pkg.github.com/${{ github.repository }}/${{ matrix.image }}:latest
outputs: type=oci,dest=/tmp/image.tar
- name: Import image in containerd
run: |
sudo ctr i import --base-name docker.io/user/app --digests --all-platforms /tmp/image.tar
- name: Push image with containerd
run: |
sudo ctr --debug i push --user "${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}" docker.pkg.github.com/${{ github.repository }}/${{ matrix.image }}:latest