Skip to content
Merged
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
60 changes: 60 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Build Docker Image
on:
workflow_call:
inputs:
platform:
required: true
description: Specify the platform supported
type: string
secrets:
TOKEN:
required: true

workflow_dispatch:
inputs:
platform:
required: true
description: Specify the platform supported
default: 'linux/amd64'
type: choice
options:
- linux/amd64
- linux/arm64

env:
REGISTRY: ghcr.io
IMAGE_NAME: 'rag-wtf/text-splitter'

jobs:
build:
runs-on: ${{ inputs.platform == 'linux/arm64' && 'ubuntu-24.04-arm' || 'ubuntu-latest' }}
permissions:
contents: read
packages: write
steps:
- name: Show Runner
run: |
echo "Running on runner: $(uname -a)"
echo "Platform input: ${{ inputs.platform }}"

- uses: actions/checkout@v4
- name: Login to ghcr.io
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.TOKEN }}
- name: Replace slash with dash
id: replace_slash
run: |
platform_value="${{ inputs.platform }}"
replaced_value="${platform_value//\//-}"
echo "REPLACED_PLATFORM=$replaced_value" >> $GITHUB_ENV
- name: Build image and push to registry
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile
platforms: ${{ inputs.platform }}
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-${{ env.REPLACED_PLATFORM }}:latest