Files
gitea-actions/.gitea/actions/docker/action.yml
T

59 lines
1.8 KiB
YAML

name: Docker Build and Push
description: Build a Docker image and push it to the Gitea container registry
inputs:
REGISTRY:
description: "Container registry hostname"
default: "gitea.pixelparasol.com"
REGISTRY_USERNAME:
description: "Registry login username"
default: "deac"
REGISTRY_TOKEN:
description: "Registry login token or password"
required: true
IMAGE_PATH:
description: "Full registry image path (e.g. gitea.pixelparasol.com/stat-tackler/stat-tackler-api)"
required: true
IMAGE_TAG:
description: "Tag to apply in addition to latest (e.g. stage-<sha>)"
required: true
PLATFORMS:
description: "Comma-separated buildx platform list"
default: "linux/amd64,linux/arm/v7,linux/arm64"
ARTIFACT_NAME:
description: "Name of the build artifact to download"
default: "dist"
ARTIFACT_PATH:
description: "Destination path for the downloaded artifact"
default: "dist"
TAG_LATEST:
description: "Also tag and push the image as latest"
default: "false"
runs:
using: composite
steps:
- name: Login to Gitea Container Registry
uses: docker/login-action@v3
with:
registry: ${{ inputs.REGISTRY }}
username: ${{ inputs.REGISTRY_USERNAME }}
password: ${{ inputs.REGISTRY_TOKEN }}
- name: Download Build Artifact
uses: actions/download-artifact@v3
with:
name: ${{ inputs.ARTIFACT_NAME }}
path: ${{ inputs.ARTIFACT_PATH }}
- name: Docker Build and Push
shell: sh
run: |
TAGS="-t ${{ inputs.IMAGE_PATH }}:${{ inputs.IMAGE_TAG }}"
if [ "${{ inputs.TAG_LATEST }}" = "true" ]; then
TAGS="$TAGS -t ${{ inputs.IMAGE_PATH }}:latest"
fi
docker buildx build -f Dockerfile . \
--platform ${{ inputs.PLATFORMS }} \
--push \
$TAGS