From b840e66418c7551a9bd8746bb4e77c0406a36c11 Mon Sep 17 00:00:00 2001 From: Felix Bartels <1257835+fbartels@users.noreply.github.com> Date: Wed, 9 Oct 2019 19:46:54 +0200 Subject: [PATCH] Add hints about Docker caching (#255) * tweaking for docker caching * tweaks to contributing --- CONTRIBUTING.md | 5 +++-- Makefile | 8 +++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 73afbc7..9e5c315 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -5,5 +5,6 @@ email, or any other method with the owners of this repository before making a ch Please see https://github.com/zokradonh/kopano-docker/blob/master/README.md#when-building-my-own-containers-how-can-i-make-sure-my-build-works-as-expected for testing remakrs -Speeding up testing rebuilds: -- `make vcs_ref=invalid build-web` +To speed up testing rebuilds you can override the git hash that is passed as a build argument. + +Example: `make vcs_ref=invalid build-web` or `make vcs_ref=invalid build-all` diff --git a/Makefile b/Makefile index 21ad7c4..0d88106 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ core_download_version := $(shell ./version.sh core) meet_download_version := $(shell ./version.sh meet) webapp_download_version := $(shell ./version.sh webapp) zpush_download_version := $(shell ./version.sh zpush) -vcf_ref := $(shell git rev-parse --short HEAD) +vcs_ref := $(shell git rev-parse --short HEAD) KOPANO_CORE_REPOSITORY_URL := file:/kopano/repo/core KOPANO_MEET_REPOSITORY_URL := file:/kopano/repo/meet @@ -53,7 +53,7 @@ ifdef TRAVIS docker pull $(docker_repo)/kopano_$(component):builder || true endif docker build \ - --build-arg VCS_REF=$(vcf_ref) \ + --build-arg VCS_REF=$(vcs_ref) \ --build-arg docker_repo=${docker_repo} \ --build-arg KOPANO_CORE_VERSION=${core_download_version} \ --build-arg KOPANO_$(COMPONENT)_VERSION=${$(component)_download_version} \ @@ -69,14 +69,16 @@ endif --build-arg ADDITIONAL_KOPANO_PACKAGES=$(ADDITIONAL_KOPANO_PACKAGES) \ --build-arg ADDITIONAL_KOPANO_WEBAPP_PLUGINS=$(ADDITIONAL_KOPANO_WEBAPP_PLUGINS) \ --cache-from $(docker_repo)/kopano_$(component):builder \ + --cache-from $(docker_repo)/kopano_$(component):latest \ -t $(docker_repo)/kopano_$(component) $(component)/ .PHONY: build-simple build-simple: component ?= ssl build-simple: ## Helper target to build a simplified image (no Kopano repo integration). docker build \ - --build-arg VCS_REF=$(vcf_ref) \ + --build-arg VCS_REF=$(vcs_ref) \ --build-arg docker_repo=$(docker_repo) \ + --cache-from $(docker_repo)/kopano_$(component):latest \ -t $(docker_repo)/kopano_$(component) $(component)/ .PHONY: build-builder