Skip to content

Commit b91dd96

Browse files
authored
Merge pull request #276 from code0-tech/163-setup-build-cache
Add build cache
2 parents 0c18667 + af8fc51 commit b91dd96

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

.gitlab/ci/container-build.gitlab-ci.yml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,21 @@
2525
- amd64
2626
- arm64
2727
script:
28+
- CACHE_TO=""
29+
- |
30+
if [ "$C0_GH_REF_NAME" = "main" ]; then
31+
CACHE_TO="--cache-to type=registry,ref=ghcr.io/code0-tech/reticulum/ci-cache:${image}-${PLATFORM}"
32+
fi
2833
- >
2934
build_image
3035
$image
3136
$CI_PIPELINE_ID
32-
"--output type=registry,push-by-digest=true --metadata-file manifest-${CI_JOB_ID}.json"
37+
"
38+
--output type=registry,push-by-digest=true
39+
--metadata-file manifest-${CI_JOB_ID}.json
40+
--cache-from type=registry,ref=ghcr.io/code0-tech/reticulum/ci-cache:${image}-${PLATFORM}
41+
$CACHE_TO
42+
"
3343
""
3444
artifacts:
3545
paths:
@@ -40,11 +50,22 @@
4050
extends:
4151
- .image-build-base
4252
script:
53+
- CACHE_TO=""
54+
- |
55+
if [ "$C0_GH_REF_NAME" = "main" ]; then
56+
CACHE_TO="--cache-to type=registry,ref=ghcr.io/code0-tech/reticulum/ci-cache:${image}-${VARIANT}-${PLATFORM}"
57+
fi
4358
- >
4459
build_image
4560
$image
4661
$CI_PIPELINE_ID
47-
"--build-arg VARIANT=$VARIANT --output type=registry,push-by-digest=true --metadata-file manifest-${CI_JOB_ID}.json"
62+
"
63+
--build-arg VARIANT=$VARIANT
64+
--output type=registry,push-by-digest=true
65+
--metadata-file manifest-${CI_JOB_ID}.json
66+
--cache-from type=registry,ref=ghcr.io/code0-tech/reticulum/ci-cache:${image}-${VARIANT}-${PLATFORM}
67+
$CACHE_TO
68+
"
4869
""
4970
artifacts:
5071
paths:

container/sagittarius/Dockerfile.erb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ COPY projects/sagittarius/extensions/ee/app/ extensions/ee/app/
4646
# Precompile bootsnap code for faster boot times
4747
RUN bundle exec bootsnap precompile app/ lib/ <% if ee? %>extensions/ee/app/<% end %>
4848

49+
ARG RETICULUM_IMAGE_TAG=local
4950
RUN echo "$RETICULUM_IMAGE_TAG" > VERSION
5051

5152
# Entrypoint prepares the database.

0 commit comments

Comments
 (0)