Split armv7 Docker builds into separate workflow
parent
5ef5509d24
commit
f23a10a0ab
@ -0,0 +1,103 @@
|
||||
name: docker-armv7
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
paths-ignore:
|
||||
- '.github/**'
|
||||
- '.vscode/**'
|
||||
- 'chrome-extension/**'
|
||||
- 'releases/**'
|
||||
- '**/**.md'
|
||||
- '**.crx'
|
||||
- '**.pem'
|
||||
- '.dockerignore'
|
||||
- '.gitignore'
|
||||
schedule:
|
||||
- cron: '49 4 * * 2'
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
push_image:
|
||||
description: 'Push image to registry'
|
||||
required: true
|
||||
default: 'false'
|
||||
type: choice
|
||||
options:
|
||||
- 'true'
|
||||
- 'false'
|
||||
image_tag:
|
||||
description: 'Docker tag prefix (workflow appends -armv7)'
|
||||
required: true
|
||||
default: 'test'
|
||||
type: string
|
||||
|
||||
concurrency:
|
||||
group: docker-armv7-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
steps:
|
||||
- name: checkout code
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Set hash
|
||||
id: vars
|
||||
run: echo "sha_short=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Get current date
|
||||
id: date
|
||||
run: echo "date=$(date +'%Y-%m-%d')" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: create-json
|
||||
id: create-json
|
||||
uses: jsdaniell/create-json@v1.2.3
|
||||
with:
|
||||
name: "version.json"
|
||||
json: '{"type": "docker", "tag": "${{secrets.DOCKERHUB_MASTER_TAG}}-armv7", "commit": "${{ steps.vars.outputs.sha_short }}", "date": "${{ steps.date.outputs.date }}"}'
|
||||
dir: 'backend/'
|
||||
|
||||
- name: setup platform emulator
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
- name: setup multi-arch docker build
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Set push and tag values
|
||||
id: build_params
|
||||
run: |
|
||||
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
||||
echo "push=${{ github.event.inputs.push_image }}" >> "$GITHUB_OUTPUT"
|
||||
echo "tags=${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPO }}:${{ github.event.inputs.image_tag }}-armv7,ghcr.io/${{ github.repository_owner }}/${{ secrets.DOCKERHUB_REPO }}:${{ github.event.inputs.image_tag }}-armv7" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "push=true" >> "$GITHUB_OUTPUT"
|
||||
echo "tags=${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPO }}:${{ secrets.DOCKERHUB_MASTER_TAG }}-armv7,${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPO }}:${{ secrets.DOCKERHUB_MASTER_TAG }}-${{ steps.date.outputs.date }}-armv7,${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPO }}:sha-${{ steps.vars.outputs.sha_short }}-armv7,ghcr.io/${{ github.repository_owner }}/${{ secrets.DOCKERHUB_REPO }}:${{ secrets.DOCKERHUB_MASTER_TAG }}-armv7,ghcr.io/${{ github.repository_owner }}/${{ secrets.DOCKERHUB_REPO }}:${{ secrets.DOCKERHUB_MASTER_TAG }}-${{ steps.date.outputs.date }}-armv7,ghcr.io/${{ github.repository_owner }}/${{ secrets.DOCKERHUB_REPO }}:sha-${{ steps.vars.outputs.sha_short }}-armv7" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
- name: Login to DockerHub
|
||||
if: github.event_name != 'workflow_dispatch' || github.event.inputs.push_image == 'true'
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
if: github.event_name != 'workflow_dispatch' || github.event.inputs.push_image == 'true'
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: build & push armv7 image
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile
|
||||
platforms: linux/arm/v7
|
||||
push: ${{ steps.build_params.outputs.push }}
|
||||
tags: ${{ steps.build_params.outputs.tags }}
|
||||
Loading…
Reference in New Issue