mirror of
https://github.com/apotdevin/thunderhub.git
synced 2026-08-13 12:33:08 +02:00
61 lines
1.7 KiB
YAML
61 lines
1.7 KiB
YAML
name: Build and push Docker images
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
docker:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 60
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- variant: standard
|
|
tags_suffix: ''
|
|
build_args: ''
|
|
- variant: base-path
|
|
tags_suffix: 'base-'
|
|
build_args: 'BASE_PATH=/thub'
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v6.0.2
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v4.0.0
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v4.0.0
|
|
|
|
- name: Login to Docker Hub
|
|
uses: docker/login-action@v4.0.0
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
- name: Extract version from tag
|
|
id: version
|
|
run: echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Docker meta
|
|
id: meta
|
|
uses: docker/metadata-action@v6.0.0
|
|
with:
|
|
images: apotdevin/thunderhub
|
|
tags: |
|
|
type=raw,value=${{ matrix.tags_suffix }}${{ steps.version.outputs.version }}
|
|
${{ matrix.variant == 'standard' && 'type=raw,value=latest' || '' }}
|
|
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v7.0.0
|
|
with:
|
|
context: ./
|
|
file: ./Dockerfile
|
|
platforms: linux/amd64,linux/arm64
|
|
push: ${{ github.event_name == 'push' }}
|
|
build-args: ${{ matrix.build_args }}
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
cache-from: type=gha,scope=${{ matrix.variant }}
|
|
cache-to: type=gha,mode=max,scope=${{ matrix.variant }}
|