50 lines
1.3 KiB
YAML
50 lines
1.3 KiB
YAML
name: Build docker image
|
|
description: 'builds docker image'
|
|
|
|
inputs:
|
|
tag:
|
|
description: 'Docker image tag'
|
|
required: true
|
|
REGISTRY_ACCESS_TOKEN:
|
|
description: 'Registry token to authenticate'
|
|
required: true
|
|
REGISTRY_USER:
|
|
description: 'Registry user to authenticate'
|
|
required: true
|
|
|
|
outputs:
|
|
image_url:
|
|
description: 'Full image URL that was built'
|
|
value: ${{ steps.build.outputs.image_url }}
|
|
|
|
runs:
|
|
using: 'composite'
|
|
steps:
|
|
- name: Set up Docker Build
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Log in to registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ vars.INSTANCE_URL }}
|
|
username: ${{ inputs.REGISTRY_USER }}
|
|
password: ${{ inputs.REGISTRY_ACCESS_TOKEN }}
|
|
|
|
- name: Set repository variable
|
|
shell: bash
|
|
run: |
|
|
REPOSITORY=$(echo "${{ gitea.repository }}" | tr '[:upper:]' '[:lower:]')
|
|
echo "REPOSITORY=$REPOSITORY" >> $GITHUB_ENV
|
|
echo "Repository: $REPOSITORY"
|
|
|
|
- name: Build and push image
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
push: true
|
|
tags: '${{ vars.INSTANCE_URL }}/$REPOSITORY:${{ inputs.tag }}'
|
|
|
|
- name: Set output
|
|
shell: bash
|
|
run: |
|
|
echo "image_url=${{ vars.INSTANCE_URL }}/${{ gitea.repository }}:${{ inputs.tag }}" >> $GITHUB_OUTPUT
|