Skip to content

Commit eaee542

Browse files
authored
Merge pull request #149 from rostilos/1.5.1-rc
feat: Enhance Docker image build process with GitHub Actions layer ca…
2 parents fa017a9 + 806564f commit eaee542

1 file changed

Lines changed: 19 additions & 3 deletions

File tree

deployment/ci/ci-build.sh

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ else
6565
echo " ⚠ Platform MCP JAR not found (optional)"
6666
fi
6767

68-
# ── 4. Build Docker Images ────────────────────────────────────────────────
68+
# ── 4. Build Docker Images (with GitHub Actions layer cache) ───────────────
6969
echo "--- 4. Building Docker images ---"
7070

7171
IMAGES=(
@@ -76,13 +76,29 @@ IMAGES=(
7676
"codecrow/web-frontend|frontend"
7777
)
7878

79+
# Use BuildKit + GitHub Actions cache backend so base-image pulls, pip install,
80+
# npm ci, apk add, etc. are cached across CI runs.
81+
7982
for entry in "${IMAGES[@]}"; do
8083
IFS='|' read -r IMAGE_NAME CONTEXT DOCKERFILE <<< "$entry"
84+
# Scope cache per image to avoid collisions
85+
SCOPE="$(echo "$IMAGE_NAME" | tr '/' '-')"
8186
echo " Building $IMAGE_NAME from $CONTEXT ..."
8287
if [ -n "${DOCKERFILE:-}" ]; then
83-
docker build -t "${IMAGE_NAME}:latest" -f "$CONTEXT/$DOCKERFILE" "$CONTEXT"
88+
docker buildx build \
89+
--cache-from "type=gha,scope=$SCOPE" \
90+
--cache-to "type=gha,mode=max,scope=$SCOPE" \
91+
--load \
92+
-t "${IMAGE_NAME}:latest" \
93+
-f "$CONTEXT/$DOCKERFILE" \
94+
"$CONTEXT"
8495
else
85-
docker build -t "${IMAGE_NAME}:latest" "$CONTEXT"
96+
docker buildx build \
97+
--cache-from "type=gha,scope=$SCOPE" \
98+
--cache-to "type=gha,mode=max,scope=$SCOPE" \
99+
--load \
100+
-t "${IMAGE_NAME}:latest" \
101+
"$CONTEXT"
86102
fi
87103
echo "$IMAGE_NAME built"
88104
done

0 commit comments

Comments
 (0)