name: Build Container Image on: workflow_dispatch: inputs: tag: description: 'Image tag' required: false default: 'latest' type: string env: REGISTRY: ${{ secrets.CONTAINER_REGISTRY }} IMAGE_NAME: ${{ secrets.IMAGE_NAME }} jobs: build: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 - name: Log in to Container Registry uses: docker/login-action@v3 with: registry: ${{ env.REGISTRY }} username: ${{ secrets.REGISTRY_USERNAME }} password: ${{ secrets.REGISTRY_PASSWORD }} - name: Extract metadata id: meta uses: docker/metadata-action@v5 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} tags: | type=raw,value=${{ inputs.tag }} type=sha,prefix={{branch}}- - name: Build and push Docker image uses: docker/build-push-action@v5 with: context: . push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - name: Output image tags run: | echo "Built and pushed image tags: ${{ steps.meta.outputs.tags }}"