3 ms·
I've recently started using Makefiles for this reason, it cut my cache hit on checking if my docker image needs a rebuild based on dependencies from 1.8s to 0.0
by munro 9y ago
I've recently started using Makefiles for this reason, it cut my cache hit on checking if my docker image needs a rebuild based on dependencies from 1.8s to 0.03s. My workflow had me hitting this check probably 20 times/day, so it was a huge time save!
IGNORE_FILES := "Makefile\|.gitignore\|.dockerignore"
DOCKER_CONTEXT := $(shell git ls-files -cmo --exclude-standard \
--exclude-from=.dockerignore \
| grep -v $(IGNORE_FILES))
.PHONY: build
build: .build/docker_image
.build/docker_image: .build $(DOCKER_CONTEXT)
docker build -t $(IMAGE) .
docker images -q $(IMAGE) > $@
.build:
@mkdir -p $@
I'm still figuring this stuff out, so I would love any feedback. :)