Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 85 additions & 0 deletions .github/workflows/kcrow-plugin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: kcrow-plugin
permissions:
contents: read

on:
push:
branches: [ kcrow-plugin ]
workflow_dispatch:
inputs:
branch:
description: 'branch'
required: true
default: 'main'
tag:
description: 'image tag'
required: false
default: ''
env:
REPO: kcrow-io/plugins
PROJECT: plugins
BRANCH: main
Dockerfile: Dockerfile-kcrowplugin
REGISTRY_NAME: "${{ secrets.MY_HUB_NAME }}"
REGISTRY_USER: "${{ secrets.MY_HUB_USER }}"
REGISTRY_PASS: "${{ secrets.MY_HUB_PASSWORD }}"
BUILDX_NO_DEFAULT_ATTESTATIONS: 1

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:

- name: Getting image tag
id: tag
run: |
echo "trigger by ${{ github.event_name }}"
echo "sha256 is ${{ github.sha }}"

if ${{ github.event_name == 'workflow_dispatch' }} ; then
echo "vbranch=${{ github.event.inputs.branch }}" >> $GITHUB_ENV
if [ "${{ github.event.inputs.tag }}" != "" ] ; then
echo "tag=${{ github.event.inputs.tag }}" >> $GITHUB_ENV
else
echo "tag=${{ github.event.inputs.branch }}" >> $GITHUB_ENV
fi
else
echo "vbranch=${{ env.BRANCH }}" >> $GITHUB_ENV
echo "tag=${{ env.BRANCH }}" >> $GITHUB_ENV
fi
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- name: Login to Registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY_NAME }}
username: ${{ env.REGISTRY_USER }}
password: ${{ env.REGISTRY_PASS }}

- name: Check out build code
uses: actions/checkout@v4
with:
repository: ${{ env.REPO }}
ref: ${{ env.vbranch }}
path: ${{ env.PROJECT }}

- name: Docker Image(arm64) Build And Push
run: |
cd ${{ env.PROJECT }}
docker buildx build --no-cache \
--platform linux/arm64 \
--provenance false --sbom false \
--output "type=image,push=true" \
--tag ${{ env.REGISTRY_NAME }}/arm64v8/kcrowplugins:${{ env.tag }} \
--file ../${{ env.Dockerfile }} .

- name: Docker Image(amd64) Build And Push
run: |
cd ${{ env.PROJECT }}
docker buildx build --no-cache \
--platform linux/amd64 \
--provenance false --sbom false \
--output "type=image,push=true" \
--tag ${{ env.REGISTRY_NAME }}/captain/kcrowplugins:${{ env.tag }} \
--file ../${{ env.Dockerfile }} .
18 changes: 18 additions & 0 deletions Dockerfile-kcrowplugin
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Multi-stage build for multi-arch support
# Build stage
FROM --platform=$BUILDPLATFORM golang:1.25-bookworm as builder

ARG TARGETPLATFORM

WORKDIR /app
COPY . .

RUN BUILD_PLATFORMS=$TARGETPLATFORM make build

FROM alpine:3.15

ARG TARGETPLATFORM

COPY --from=builder /app/bin/$TARGETPLATFORM/ /

RUN apk -U --no-cache add bash