Enable concurrent running of the image generation jobs (#4)

Group GPU image generate for GHCR and QUAY in one job,
and similarly group CPU only image generation for GHCR
and QUAY in another job. These two jobs can now run
concurrently.

By grouping the jobs for the same image type, it can
use the docker layer cache to run the second job faster.
If we separately build these images in four diffent and
concurrent jobs, they won't be able to use the cache.

If this still takes significantly long, we probably
have to generate image in it's own job, so that they can run
concurrently, without leveraging cache of docker layers.

Also added make file target to lint the github workflows.

Signed-off-by: Anil Vishnoi <vishnoianil@gmail.com>
This commit is contained in:
Anil Vishnoi
2024-09-13 01:31:06 -07:00
committed by GitHub
parent 4dd517c96a
commit fc11dc2540
3 changed files with 109 additions and 39 deletions

View File

@@ -9,21 +9,45 @@ help:
ifeq ($(NOISY_BUILD),)
ECHO_PREFIX=@
CMD_PREFIX=@
PIPE_DEV_NULL=> /dev/null 2> /dev/null
else
ECHO_PREFIX=@\#
CMD_PREFIX= PIPE_DEV_NULL=
CMD_PREFIX=
PIPE_DEV_NULL=
endif
TAG=$(shell git rev-parse HEAD)
lint:
$(CMD_PREFIX) touch .action-lint
.PHONY: docling-serve-cpu-image
docling-serve-cpu-image: Containerfile ## Build docling-serve "cpu only" continaer image
$(ECHO_PREFIX) printf " %-12s Containerfile\n" "[docling-serve CPU ONLY]"
$(CMD_PREFIX) docker build --build-arg CPU_ONLY=true -f Containerfile --platform linux/amd64 -t ghcr.io/ds4sd/docling-serve-cpu:$(TAG) .
$(CMD_PREFIX) docker tag ghcr.io/ds4sd/docling-serve-cpu:$(TAG) ghcr.io/ds4sd/docling-serve-cpu:main
$(CMD_PREFIX) docker tag ghcr.io/ds4sd/docling-serve-cpu:$(TAG) quay.io/ds4sd/docling-serve-cpu:main
.PHONY: docling-serve-gpu-image
docling-serve-gpu-image: Containerfile ## Build docling-serve continaer image with GPU support
$(ECHO_PREFIX) printf " %-12s Containerfile\n" "[docling-serve with GPU]"
$(CMD_PREFIX) docker build --build-arg CPU_ONLY=false -f Containerfile --platform linux/amd64 -t ghcr.io/ds4sd/docling-serve:$(TAG) .
$(CMD_PREFIX) docker tag ghcr.io/ds4sd/docling-serve:$(TAG) ghcr.io/ds4sd/docling-serve:main
$(CMD_PREFIX) docker tag ghcr.io/ds4sd/docling-serve:$(TAG) quay.io/ds4sd/docling-serve:main
.PHONY: action-lint
action-lint: .action-lint ## Lint GitHub Action workflows
.action-lint: $(shell find .github -type f) | lint
$(ECHO_PREFIX) printf " %-12s .github/...\n" "[ACTION LINT]"
$(CMD_PREFIX) if ! which actionlint $(PIPE_DEV_NULL) ; then \
echo "Please install actionlint." ; \
echo "go install github.com/rhysd/actionlint/cmd/actionlint@latest" ; \
exit 1 ; \
fi
$(CMD_PREFIX) if ! which shellcheck $(PIPE_DEV_NULL) ; then \
echo "Please install shellcheck." ; \
echo "https://github.com/koalaman/shellcheck#user-content-installing" ; \
exit 1 ; \
fi
$(CMD_PREFIX) actionlint -color
$(CMD_PREFIX) touch $@