mirror of
https://github.com/BrenBroZAYT/gameyfin.git
synced 2026-06-14 08:15:27 +00:00
77 lines
2.2 KiB
YAML
77 lines
2.2 KiB
YAML
name: 'Docker Build and Push'
|
|
description: 'Builds and pushes Docker images to Docker Hub and GHCR with flexible tagging.'
|
|
runs:
|
|
using: 'composite'
|
|
steps:
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Log in to Docker Hub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ inputs.dockerhub_username }}
|
|
password: ${{ inputs.dockerhub_token }}
|
|
|
|
- name: Log in to GitHub Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ inputs.ghcr_username }}
|
|
password: ${{ inputs.ghcr_token }}
|
|
|
|
- name: Prepare Ubuntu tags
|
|
id: ubuntu_tags
|
|
shell: bash
|
|
run: |
|
|
TAGS="${{ inputs.tags }}"
|
|
UBUNTU_TAGS=$(echo "$TAGS" | awk -F, '{for(i=1;i<=NF;i++){split($i,a,":"); printf "%s:%s-ubuntu", a[1], a[2]; if(i<NF) printf ","}}')
|
|
echo "ubuntu_tags=$UBUNTU_TAGS" >> $GITHUB_OUTPUT
|
|
|
|
- name: Build and push Docker image (Alpine)
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: ${{ inputs.context }}
|
|
file: ${{ inputs.dockerfile }}
|
|
platforms: ${{ inputs.platforms }}
|
|
push: true
|
|
tags: ${{ inputs.tags }}
|
|
cache-from: type=gha
|
|
cache-to: type=gha
|
|
|
|
- name: Build and push Docker image (Ubuntu)
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: ${{ inputs.context }}
|
|
file: docker/Dockerfile.ubuntu
|
|
platforms: ${{ inputs.platforms }}
|
|
push: true
|
|
tags: ${{ steps.ubuntu_tags.outputs.ubuntu_tags }}
|
|
cache-from: type=gha
|
|
cache-to: type=gha
|
|
|
|
inputs:
|
|
dockerhub_username:
|
|
required: true
|
|
description: 'Docker Hub username'
|
|
dockerhub_token:
|
|
required: true
|
|
description: 'Docker Hub token'
|
|
ghcr_username:
|
|
required: true
|
|
description: 'GHCR username'
|
|
ghcr_token:
|
|
required: true
|
|
description: 'GHCR token'
|
|
context:
|
|
required: true
|
|
description: 'Build context'
|
|
dockerfile:
|
|
required: true
|
|
description: 'Dockerfile path'
|
|
platforms:
|
|
required: true
|
|
description: 'Platforms to build for'
|
|
tags:
|
|
required: true
|
|
description: 'Comma-separated list of image tags'
|