mirror of
https://github.com/eduardolat/pgbackweb.git
synced 2026-01-28 07:29:10 -06:00
53 lines
1.4 KiB
YAML
53 lines
1.4 KiB
YAML
name: Build & Publish Docker Image
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
commit:
|
|
description: "Commit SHA or branch to build"
|
|
required: true
|
|
default: "main"
|
|
tags:
|
|
description: "Array of docker image tags to build and push separated by commas"
|
|
required: true
|
|
default: "latest"
|
|
|
|
jobs:
|
|
build-and-publish:
|
|
name: Build and Publish Docker Image
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ github.event.inputs.commit }}
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Login to Docker Hub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USER }}
|
|
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}
|
|
|
|
- name: Build and push Docker image
|
|
run: |
|
|
docker buildx create --use
|
|
|
|
IFS=',' read -r -a tags <<< "${{ github.event.inputs.tags }}"
|
|
tag_args=""
|
|
for tag in "${tags[@]}"; do
|
|
tag_args="$tag_args -t eduardolat/pgbackweb:$tag"
|
|
done
|
|
|
|
docker buildx build \
|
|
--platform linux/amd64,linux/arm64 \
|
|
--build-arg TARGETPLATFORM \
|
|
$tag_args \
|
|
-f ./docker/Dockerfile \
|
|
--push .
|