refactor: image building
refactor image building, add more variants
This commit is contained in:
@@ -0,0 +1,112 @@
|
||||
name: Build alpine images
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: 0 12 */7 * *
|
||||
push:
|
||||
paths:
|
||||
- '.github/workflows/build-alpine.yml'
|
||||
- 'linux/alpine/act/**'
|
||||
pull_request:
|
||||
paths:
|
||||
- '.github/workflows/build-alpine.yml'
|
||||
- 'linux/alpine/act/**'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ ( github.actor == github.repository_owner && github.event_name != 'pull_request' ) || ( github.actor != github.repository_owner ) }}
|
||||
steps:
|
||||
- name: Login to GitHub Container Registry
|
||||
id: ghcr
|
||||
if: ${{ github.actor == github.repository_owner }}
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Login to Quay
|
||||
id: quay
|
||||
if: ${{ github.actor == github.repository_owner }}
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
registry: quay.io
|
||||
username: ${{ secrets.QUAY_USER }}
|
||||
password: ${{ secrets.QUAY_TOKEN }}
|
||||
|
||||
- name: Login to Docker Hub
|
||||
id: dckr
|
||||
if: ${{ github.actor == github.repository_owner }}
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USER }}
|
||||
password: ${{ secrets.DOCKER_TOKEN }}
|
||||
|
||||
- name: Print date in UTC format
|
||||
id: print-date
|
||||
run: echo "::set-output name=date::$(date +%Y%m%d)"
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v1
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Build and push ${{ github.repository_owner }}/alpine:act-${{ steps.print-date.outputs.date }}
|
||||
id: act
|
||||
uses: docker/build-push-action@v2
|
||||
env:
|
||||
GHCR_TAG: ghcr.io/${{ github.repository_owner }}/alpine:act
|
||||
QUAY_TAG: quay.io/${{ github.repository_owner }}/alpine:act
|
||||
DCKR_TAG: docker.io/${{ github.repository_owner }}/alpine:act
|
||||
with:
|
||||
context: .
|
||||
push: ${{ github.event_name != 'pull_request' && github.event_name != 'push' }}
|
||||
file: ./linux/alpine/act/base/Dockerfile
|
||||
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
||||
tags: |
|
||||
${{ env.GHCR_TAG }}
|
||||
${{ env.GHCR_TAG }}-${{ steps.print-date.outputs.date }}
|
||||
${{ env.QUAY_TAG }}
|
||||
${{ env.QUAY_TAG }}-${{ steps.print-date.outputs.date }}
|
||||
${{ env.DCKR_TAG }}
|
||||
${{ env.DCKR_TAG }}-${{ steps.print-date.outputs.date }}
|
||||
build-args: |
|
||||
BASEIMAGE=node
|
||||
TAG=lts-alpine3.13
|
||||
DISTRIB_RELEASE=${{ steps.release.outputs.RELEASE }}
|
||||
BUILD_TAG_VERSION=${{ steps.print-date.outputs.date }}
|
||||
BUILD_TAG=act
|
||||
BUILD_REF=${{ github.sha }}
|
||||
|
||||
- name: Build and push ${{ github.repository_owner }}/alpine:runner-${{ steps.print-date.outputs.date }}
|
||||
id: runner
|
||||
uses: docker/build-push-action@v2
|
||||
if: ${{ github.event_name != 'pull_request' && github.event_name != 'push' }}
|
||||
env:
|
||||
GHCR_TAG: ghcr.io/${{ github.repository_owner }}/alpine:runner
|
||||
QUAY_TAG: quay.io/${{ github.repository_owner }}/alpine:runner
|
||||
DCKR_TAG: docker.io/${{ github.repository_owner }}/alpine:runner
|
||||
with:
|
||||
context: .
|
||||
push: ${{ github.event_name != 'pull_request' && github.event_name != 'push' }}
|
||||
file: ./linux/alpine/act/runner/Dockerfile
|
||||
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
||||
tags: |
|
||||
${{ env.GHCR_TAG }}
|
||||
${{ env.GHCR_TAG }}-${{ steps.print-date.outputs.date }}
|
||||
${{ env.QUAY_TAG }}
|
||||
${{ env.QUAY_TAG }}-${{ steps.print-date.outputs.date }}
|
||||
${{ env.DCKR_TAG }}
|
||||
${{ env.DCKR_TAG }}-${{ steps.print-date.outputs.date }}
|
||||
build-args: |
|
||||
BASEIMAGE=catthehacker/alpine
|
||||
TAG=act-${{ steps.print-date.outputs.date }}
|
||||
BUILD_TAG_VERSION=${{ steps.print-date.outputs.date }}
|
||||
BUILD_TAG=runner
|
||||
BUILD_REF=${{ github.sha }}
|
||||
Reference in New Issue
Block a user