Skip to content

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

Python

fix: cache images with architecture and check architecture in startup scripts (#2087)

Lucas Oliveira7f3ee048d24c
diff --git a/.github/workflows/test-ci.yml b/.github/workflows/test-ci.yml
index 28fb59e2a..45ac1cfb8 100644
--- a/.github/workflows/test-ci.yml
+++ b/.github/workflows/test-ci.yml
@@ -69,6 +69,23 @@ jobs:
runs-on:
labels: "ubuntu-latest"
steps:
+ - name: Maximize build space
+ uses: easimon/maximize-build-space@v10
+ continue-on-error: true
+ with:
+ root-reserve-mb: 40960
+ temp-reserve-mb: 30720
+ remove-dotnet: 'true'
+ remove-android: 'true'
+ remove-haskell: 'true'
+ remove-codeql: 'true'
+ remove-docker-images: 'true'
+ build-mount-path: '/var/lib/docker'
+
+ - name: Restart Docker
+ continue-on-error: true
+ run: sudo service docker restart || sudo systemctl restart docker || true
+
- run: df -h
- name: Cleanup Docker cache
@@ -115,25 +132,25 @@ jobs:
uses: actions/cache@v4
with:
path: /tmp/image-cache/opensearch.tar
- key: ${{ runner.os }}-image-opensearch-${{ steps.cache-keys.outputs.opensearch }}
+ key: ${{ runner.os }}-${{ runner.arch }}-opensearch-${{ steps.cache-keys.outputs.opensearch }}
- name: Cache Backend Image
uses: actions/cache@v4
with:
path: /tmp/image-cache/backend.tar
- key: ${{ runner.os }}-image-backend-${{ steps.cache-keys.outputs.backend }}
+ key: ${{ runner.os }}-${{ runner.arch }}-backend-${{ steps.cache-keys.outputs.backend }}
- name: Cache Frontend Image
uses: actions/cache@v4
with:
path: /tmp/image-cache/frontend.tar
- key: ${{ runner.os }}-image-frontend-${{ steps.cache-keys.outputs.frontend }}
+ key: ${{ runner.os }}-${{ runner.arch }}-frontend-${{ steps.cache-keys.outputs.frontend }}
- name: Cache Langflow Image
uses: actions/cache@v4
with:
path: /tmp/image-cache/langflow.tar
- key: ${{ runner.os }}-image-langflow-${{ steps.cache-keys.outputs.langflow }}
+ key: ${{ runner.os }}-${{ runner.arch }}-langflow-${{ steps.cache-keys.outputs.langflow }}
- name: Build OpenRAG images
run: |
@@ -145,14 +162,40 @@ jobs:
local name=$1
local dockerfile=$2
local tar_path="/tmp/image-cache/${name}.tar"
+ local use_cache=false
if [ -f "$tar_path" ]; then
- echo "Cache hit for ${name}. Loading image from ${tar_path}..."
+ echo "Found cache file for ${name}. Inspecting architecture..."
docker load -i "$tar_path"
- echo "Tagging loaded image as langflowai/openrag-${name}:${CI_IMAGE_TAG}..."
- docker tag "langflowai/openrag-${name}:cached" "langflowai/openrag-${name}:${CI_IMAGE_TAG}"
- else
- echo "Cache miss for ${name}. Building..."
+
+ # Get host normalized architecture
+ local host_arch="$(uname -m)"
+ local host_arch_norm=""
+ if [[ "$host_arch" == "x86_64" ]]; then
+ host_arch_norm="amd64"
+ elif [[ "$host_arch" == "aarch64" || "$host_arch" == "arm64" ]]; then
+ host_arch_norm="arm64"
+ else
+ host_arch_norm="$host_arch"
+ fi
+
+ local loaded_arch=""
+ loaded_arch=$(docker inspect --format '{{.Architecture}}' "langflowai/openrag-${name}:cached" 2>/dev/null || echo "unknown")
+
+ if [ "$loaded_arch" = "$host_arch_norm" ]; then
+ echo "Cache hit for ${name}. Loaded image matches host architecture ($host_arch_norm)."
+ use_cache=true
+ echo "Tagging loaded image as langflowai/openrag-${name}:${CI_IMAGE_TAG}..."
+ docker tag "langflowai/openrag-${name}:cached" "langflowai/openrag-${name}:${CI_IMAGE_TAG}"
+ else
+ echo "Cache image architecture ($loaded_arch) does not match host architecture ($host_arch_norm). Discarding cache."
+ docker rmi "langflowai/openrag-${name}:cached" 2>/dev/null || true
+ rm -f "$tar_path"
+ fi
+ fi
+
+ if [ "$use_cache" = "false" ]; then
+ echo "Cache miss/incompatible for ${name}. Building..."
if docker buildx build \
--load \
-t "langflowai/openrag-${name}:cached" \
@@ -233,6 +276,23 @@ jobs:
suite: [core, sdk-python, sdk-typescript]
name: tests (${{ matrix.suite }})
steps:
+ - name: Maximize build space
+ uses: easimon/maximize-build-space@v10
+ continue-on-error: true
+ with:
+ root-reserve-mb: 40960
+ temp-reserve-mb: 30720
+ remove-dotnet: 'true'
+ remove-android: 'true'
+ remove-haskell: 'true'
+ remove-codeql: 'true'
+ remove-docker-images: 'true'
+ build-mount-path: '/var/lib/docker'
+
+ - name: Restart Docker
+ continue-on-error: true
+ run: sudo service docker restart || sudo systemctl restart docker || true
+
- run: df -h
- name: Cleanup Docker cache
@@ -335,6 +395,23 @@ jobs:
total_shards: [8]
name: e2e (shard ${{ matrix.shard }}/${{ matrix.total_shards }})
steps:
+ - name: Maximize build space
+ uses: easimon/maximize-build-space@v10
+ continue-on-error: true
+ with:
+ root-reserve-mb: 40960
+ temp-reserve-mb: 30720
+ remove-dotnet: 'true'
+ remove-android: 'true'
+ remove-haskell: 'true'
+ remove-codeql: 'true'
+ remove-docker-images: 'true'
+ build-mount-path: '/var/lib/docker'
+
+ - name: Restart Docker
+ continue-on-error: true
+ run: sudo service docker restart || sudo systemctl restart docker || true
+
- name: Cleanup Docker cache
run: |
docker compose -f docker-compose.yml down -v --remove-orphans || true
diff --git a/scripts/ci/run_integration_suite.sh b/scripts/ci/run_integration_suite.sh
index 42ae094cc..79f386c08 100755
--- a/scripts/ci/run_integration_suite.sh
+++ b/scripts/ci/run_integration_suite.sh
@@ -148,6 +148,28 @@ echo "${yellow}Starting infra for suite '${suite}' with OpenRAG version '${OPENR
OPENSEARCH_HOST=opensearch "${compose_cmd[@]}" up -d opensearch langflow openrag-backend openrag-frontend
echo "${cyan}Architecture: $(uname -m), Platform: $(uname -s)${nc}"
+
+# Normalize host architecture
+host_arch="$(uname -m)"
+host_arch_norm=""
+if [[ "$host_arch" == "x86_64" ]]; then
+ host_arch_norm="amd64"
+elif [[ "$host_arch" == "aarch64" || "$host_arch" == "arm64" ]]; then
+ host_arch_norm="arm64"
+else
+ host_arch_norm="$host_arch"
+fi
+
+# Get image architecture
+image_name="langflowai/openrag-backend:${OPENRAG_VERSION:-latest}"
+image_arch=$("$container_runtime" inspect --format '{{.Architecture}}' "$image_name" 2>/dev/null || echo "")
+
+if [[ -n "$image_arch" && "$image_arch" != "$host_arch_norm" ]]; then
+ echo "${red}WARNING: Architecture mismatch detected!${nc}"
+ echo "${red}Host architecture is '${host_arch}' (${host_arch_norm}), but container image architecture is '${image_arch}'.${nc}"
+ echo "${red}The backend will run under QEMU emulation, which is extremely slow and may cause timeouts.${nc}"
+fi
+
echo "${yellow}Starting docling-serve...${nc}"
docling_start_failed=0
docling_start_output="$(uv run python scripts/docling_ctl.py start --port 5001 --timeout 180 2>&1)" || docling_start_failed=1
@@ -175,6 +197,9 @@ for i in $(seq 1 60); do
fi
if [[ "$i" -eq 60 ]]; then
echo "${red}Backend OIDC endpoint was not reachable in time${nc}"
+ echo "${yellow}--- Last 50 lines of backend logs ---${nc}"
+ "$container_runtime" logs --tail 50 "${COMPOSE_PROJECT_NAME}-backend" 2>&1 || true
+ echo "${yellow}------------------------------------${nc}"
exit 1
fi
sleep 2
diff --git a/scripts/setup-e2e.sh b/scripts/setup-e2e.sh
index dc0b6525b..eba0e8785 100644
--- a/scripts/setup-e2e.sh
+++ b/scripts/setup-e2e.sh
@@ -69,6 +69,27 @@ BACKEND_PROXY_NAME="${COMPOSE_PROJECT_NAME}-backend-proxy"
echo "Using container runtime: $CONTAINER_RUNTIME"
echo "Starting E2E Setup..."
+# Normalize host architecture
+host_arch="$(uname -m)"
+host_arch_norm=""
+if [[ "$host_arch" == "x86_64" ]]; then
+ host_arch_norm="amd64"
+elif [[ "$host_arch" == "aarch64" || "$host_arch" == "arm64" ]]; then
+ host_arch_norm="arm64"
+else
+ host_arch_norm="$host_arch"
+fi
+
+# Get image architecture
+image_name="langflowai/openrag-backend:${OPENRAG_VERSION:-latest}"
+image_arch=$(${CONTAINER_RUNTIME} inspect --format '{{.Architecture}}' "$image_name" 2>/dev/null || echo "")
+
+if [[ -n "$image_arch" && "$image_arch" != "$host_arch_norm" ]]; then
+ echo "WARNING: Architecture mismatch detected!"
+ echo "Host architecture is '${host_arch}' (${host_arch_norm}), but container image architecture is '${image_arch}'."
+ echo "The backend will run under QEMU emulation, which is extremely slow and may cause timeouts."
+fi
+
# Pre-create langflow-data as world-writable so the Langflow container (UID 1000)
# and the runner (UID 1001) can both access it, regardless of Docker's :U flag behavior.
mkdir -p langflow-data