From e89018f6acbfd8372b79f26baab058925f992c95 Mon Sep 17 00:00:00 2001 From: Ildar Iskhakov Date: Thu, 2 Nov 2023 11:48:00 +0800 Subject: [PATCH] Add BUILDKIT_INLINE_CACHE build arg to docker builder step (#3245) # What this PR does `BUILDKIT_INLINE_CACHE` is required by `--cache-from`, otherwise it won't work. It will improve build speeds when running `tilt up` ## Which issue(s) this PR fixes ## Checklist - [ ] Unit, integration, and e2e (if applicable) tests updated - [ ] Documentation added (or `pr:no public docs` PR label added if not required) - [ ] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not required) --- .drone.yml | 11 +++++++++++ Tiltfile | 4 +--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.drone.yml b/.drone.yml index 56377fca..8c4b3332 100644 --- a/.drone.yml +++ b/.drone.yml @@ -107,6 +107,8 @@ steps: target: prod config: from_secret: gcr_admin + build_args: + - BUILDKIT_INLINE_CACHE=1 depends_on: - Lint Backend - Unit Test Backend @@ -128,6 +130,8 @@ steps: from_secret: docker_password username: from_secret: docker_username + build_args: + - BUILDKIT_INLINE_CACHE=1 depends_on: - Lint Backend - Unit Test Backend @@ -244,6 +248,11 @@ steps: # Be aware that the this plugin requires privileged capabilities, otherwise the integrated # Docker daemon is not able to start. privileged: true + environment: + # force docker to use buildkit feature, this will skip build stages that aren't required in + # the final image (ie. dev & dev-enterprise) + # https://github.com/docker/cli/issues/1134#issuecomment-406449342 + DOCKER_BUILDKIT: 1 settings: repo: grafana/oncall tags: latest,${DRONE_TAG} @@ -255,6 +264,8 @@ steps: from_secret: docker_password username: from_secret: docker_username + build_args: + - BUILDKIT_INLINE_CACHE=1 depends_on: - set engine version diff --git a/Tiltfile b/Tiltfile index da178445..446b3970 100644 --- a/Tiltfile +++ b/Tiltfile @@ -31,13 +31,11 @@ def plugin_json(): allow_k8s_contexts(["kind-kind"]) -local_resource("download-cache", cmd="docker pull grafana/oncall:latest; docker tag grafana/oncall localhost:63628/grafana/oncall:latest") - # Build the image including frontend folder for pytest docker_build_sub( "localhost:63628/oncall/engine:dev", context="./engine", - cache_from="localhost:63628/grafana/oncall:latest", + cache_from="grafana/oncall:latest", # only=["./engine", "./grafana-plugin"], ignore=["./grafana-plugin/test-results/", "./grafana-plugin/dist/", "./grafana-plugin/e2e-tests/"], child_context=".",