Skip to content

OpenRAG is a comprehensive, single package Retrieval-Augmented Generation platform built on Langflow, Docling, and Opensearch.

Python

operator docker image build (#1452)

ming4fb112eacad3
diff --git a/.github/workflows/operator-ci.yml b/.github/workflows/operator-ci.yml
index 0916dc407..2c72188f9 100644
--- a/.github/workflows/operator-ci.yml
+++ b/.github/workflows/operator-ci.yml
@@ -59,3 +59,21 @@ jobs:
with:
version: v2.11.4
working-directory: kubernetes/operator
+
+ docker:
+ name: Docker build check
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+
+ - uses: docker/setup-buildx-action@v3
+
+ - name: Build image (no push)
+ uses: docker/build-push-action@v6
+ with:
+ context: kubernetes/operator
+ file: kubernetes/operator/Dockerfile
+ platforms: linux/amd64
+ push: false
+ cache-from: type=gha,scope=operator-amd64
+ cache-to: type=gha,mode=max,scope=operator-amd64
diff --git a/.github/workflows/operator-release.yml b/.github/workflows/operator-release.yml
new file mode 100644
index 000000000..c7315bfea
--- /dev/null
+++ b/.github/workflows/operator-release.yml
@@ -0,0 +1,106 @@
+name: Operator Release
+
+on:
+ push:
+ tags:
+ - 'operator/v*'
+ workflow_dispatch:
+ inputs:
+ tag:
+ description: 'Image tag (e.g. v0.1.0)'
+ required: true
+
+env:
+ REGISTRY: ghcr.io
+ IMAGE: ghcr.io/${{ github.repository_owner }}/openrag-operator
+
+jobs:
+ build:
+ name: Build and push (${{ matrix.platform }})
+ runs-on: ${{ matrix.runner }}
+ permissions:
+ contents: read
+ packages: write
+ strategy:
+ matrix:
+ include:
+ - platform: linux/amd64
+ runner: ubuntu-latest
+ arch: amd64
+ - platform: linux/arm64
+ runner: ubuntu-24.04-arm
+ arch: arm64
+
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Resolve image tag
+ id: tag
+ run: |
+ if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
+ echo "value=${{ inputs.tag }}" >> $GITHUB_OUTPUT
+ else
+ # Strip the "operator/" prefix from the git tag
+ echo "value=${GITHUB_REF_NAME#operator/}" >> $GITHUB_OUTPUT
+ fi
+
+ - uses: docker/setup-buildx-action@v3
+
+ - uses: docker/login-action@v3
+ with:
+ registry: ${{ env.REGISTRY }}
+ username: ${{ github.actor }}
+ password: ${{ secrets.GITHUB_TOKEN }}
+
+ - name: Build and push ${{ matrix.arch }}
+ uses: docker/build-push-action@v6
+ with:
+ context: kubernetes/operator
+ file: kubernetes/operator/Dockerfile
+ platforms: ${{ matrix.platform }}
+ push: true
+ tags: ${{ env.IMAGE }}:${{ steps.tag.outputs.value }}-${{ matrix.arch }}
+ cache-from: type=gha,scope=operator-${{ matrix.arch }}
+ cache-to: type=gha,mode=max,scope=operator-${{ matrix.arch }}
+
+ manifest:
+ name: Create multi-arch manifest
+ runs-on: ubuntu-latest
+ needs: build
+ permissions:
+ contents: write
+ packages: write
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Resolve image tag
+ id: tag
+ run: |
+ if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
+ echo "value=${{ inputs.tag }}" >> $GITHUB_OUTPUT
+ else
+ echo "value=${GITHUB_REF_NAME#operator/}" >> $GITHUB_OUTPUT
+ fi
+
+ - uses: docker/login-action@v3
+ with:
+ registry: ${{ env.REGISTRY }}
+ username: ${{ github.actor }}
+ password: ${{ secrets.GITHUB_TOKEN }}
+
+ - name: Push multi-arch manifest
+ run: |
+ TAG=${{ steps.tag.outputs.value }}
+ docker buildx imagetools create \
+ -t ${{ env.IMAGE }}:${TAG} \
+ -t ${{ env.IMAGE }}:latest \
+ ${{ env.IMAGE }}:${TAG}-amd64 \
+ ${{ env.IMAGE }}:${TAG}-arm64
+
+ - name: Create GitHub release
+ uses: softprops/action-gh-release@v2
+ if: github.event_name == 'push'
+ with:
+ tag_name: ${{ github.ref_name }}
+ name: Operator ${{ steps.tag.outputs.value }}
+ generate_release_notes: true
diff --git a/kubernetes/operator/Dockerfile b/kubernetes/operator/Dockerfile
new file mode 100644
index 000000000..0ef4bfcf7
--- /dev/null
+++ b/kubernetes/operator/Dockerfile
@@ -0,0 +1,18 @@
+FROM golang:1.26.0 AS builder
+WORKDIR /workspace
+
+COPY go.mod go.sum ./
+RUN go mod download
+
+COPY api/ api/
+COPY cmd/ cmd/
+COPY internal/ internal/
+COPY hack/ hack/
+
+RUN CGO_ENABLED=0 GOOS=linux go build -a -o manager cmd/main.go
+
+FROM gcr.io/distroless/static:nonroot
+WORKDIR /
+COPY --from=builder /workspace/manager .
+USER 65532:65532
+ENTRYPOINT ["/manager"]