From aded60c921305233a35e031f6c1b722151960299 Mon Sep 17 00:00:00 2001 From: aron Date: Thu, 29 Aug 2024 14:07:22 +0200 Subject: [PATCH] Cache frontend resources --- .gitlab-ci.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a8b158974..fed530ef1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -181,13 +181,16 @@ build-release: CACHE_RELEASE_TAG=test-$VERSION_NUMBER_LEADING_ZEROS else CACHE_RELEASE_TAG=$CI_COMMIT_SHORT_SHA + # Build and push api-statics + API_STATICS_IMAGE=$CI_REGISTRY_IMAGE/api-statics:$CI_COMMIT_TAG + docker buildx build --provenance false --build-arg BUILDKIT_INLINE_CACHE=1 --cache-from $CI_REGISTRY_IMAGE/pdfviewer-dev:$ISO_WEEK --cache-from $CI_REGISTRY_IMAGE/frontend-dev:$ISO_WEEK --target=api-statics --platform linux/amd64,linux/arm64 --push -t $API_STATICS_IMAGE . fi # Build containers - cd languagetool - docker buildx build --provenance false --build-arg BUILDKIT_INLINE_CACHE=1 --cache-from $CI_REGISTRY_IMAGE/languagetool:$CACHE_RELEASE_TAG --platform linux/amd64,linux/arm64 --push -t $CI_REGISTRY_IMAGE/languagetool:$CI_COMMIT_TAG . - cd .. - export VERSION_NUMBER - - docker buildx build --provenance false --build-arg BUILDKIT_INLINE_CACHE=1 --build-arg VERSION="$VERSION_NUMBER" --cache-from $CI_REGISTRY_IMAGE/api-test:$CI_COMMIT_SHORT_SHA --cache-from $CI_REGISTRY_IMAGE:$CACHE_RELEASE_TAG --target=api --platform linux/amd64,linux/arm64 --push --tag $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG . + - docker buildx build --provenance false --build-arg BUILDKIT_INLINE_CACHE=1 --build-arg VERSION="$VERSION_NUMBER" --cache-from $CI_REGISTRY_IMAGE/api-test:$CI_COMMIT_SHORT_SHA --cache-from $CI_REGISTRY_IMAGE:$CACHE_RELEASE_TAG --cache-from $API_STATICS_IMAGE --target=api --platform linux/amd64,linux/arm64 --push --tag $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG . release-gitlab-release: stage: release @@ -227,7 +230,7 @@ release-prod: - rm -rf docs/docs/s docs/README.md docs/reporting_software.yml docs/wip docs/hooks.py dev .vscode api/.vscode # Build container with copyleft source code - - docker buildx build --build-arg BUILDKIT_INLINE_CACHE=1 --provenance false --cache-from $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG --target api-src --build-arg VERSION=$VERSION_NUMBER --target=api --platform linux/amd64,linux/arm64 --push --tag $DOCKER_HUB_IMAGE:$VERSION_NUMBER-src . + - docker buildx build --build-arg BUILDKIT_INLINE_CACHE=1 --provenance false --cache-from $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG --cache-from $CI_REGISTRY_IMAGE/api-statics:test-$VERSION_NUMBER_LEADING_ZEROS --target api-src --build-arg VERSION=$VERSION_NUMBER --target=api --platform linux/amd64,linux/arm64 --push --tag $DOCKER_HUB_IMAGE:$VERSION_NUMBER-src . # Push containers to Docker Hub - docker buildx imagetools create $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG --tag $DOCKER_HUB_IMAGE:$VERSION_NUMBER - docker buildx imagetools create $DOCKER_HUB_IMAGE:$VERSION_NUMBER --tag $DOCKER_HUB_IMAGE:latest