Optimize build: Kaniko cache flags, split Dockerfile stages, install-tools script

- Kaniko: --cache-ttl=168h, --snapshot-mode=redo, --compressed-caching=false
- Dockerfile: Split server-build into server-deps + server-build for better layer caching
- Replace rm+reinstall node_modules with npm prune --omit=dev
- Move ffmpeg/yt-dlp install to tools/install-tools.sh (single RUN layer)
- Remove separate ffmpeg-fetch stage and inline curl/yt-dlp install
- Remove $CI_COMMIT_SHA tag destination (unused, saves push time)
- bump-version: alpine/git image instead of alpine + apk add git

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Daniel 2026-03-07 15:39:01 +01:00
parent 6c57419959
commit 259c87bfd3
3 changed files with 37 additions and 21 deletions

View file

@ -47,13 +47,12 @@ docker-build:
CHANNEL="dev"
fi
DESTINATIONS="--destination=$IMAGE_NAME:$CI_COMMIT_SHA --destination=$IMAGE_NAME:$TAG"
DESTINATIONS="--destination=$IMAGE_NAME:$TAG"
if [ "$CI_COMMIT_REF_NAME" = "main" ]; then
DESTINATIONS="$DESTINATIONS --destination=$IMAGE_NAME:latest"
fi
echo "Building for channel $CHANNEL with version $VERSION and tag $TAG"
echo "Using registry image: $IMAGE_NAME"
/kaniko/executor \
--context "$CI_PROJECT_DIR" \
@ -62,6 +61,9 @@ docker-build:
--build-arg "VITE_APP_VERSION=$VERSION" \
--cache=true \
--cache-repo="$IMAGE_NAME/cache" \
--cache-ttl=168h \
--snapshot-mode=redo \
--compressed-caching=false \
--insecure-registry=$INTERNAL_REGISTRY \
$DESTINATIONS
@ -106,12 +108,11 @@ deploy:
bump-version:
stage: bump-version
image: alpine:latest
image: alpine/git:latest
needs: [deploy]
rules:
- if: $CI_COMMIT_BRANCH == "main" && $CI_COMMIT_TITLE !~ /\[skip ci\]/
script:
- apk add --no-cache git
- |
git config user.name "GitLab CI"
git config user.email "ci@adriahub.de"