Skip to content

Commit

Permalink
[make] Take the rest of docker-build.sh arguments as docker build arg…
Browse files Browse the repository at this point in the history
…uments (#13910)

#13890 removed an optional argument to `docker-build.sh`. Now that there
are no optional arguments I think it is cleaner to claim any additional
arguments as docker args instead of stuffing docker args into an
environment variable.
  • Loading branch information
daniel-goldstein authored Oct 27, 2023
1 parent 06f7483 commit 010ff09
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 19 deletions.
30 changes: 12 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -151,25 +151,22 @@ $(HAILTOP_VERSION):
hailgenetics-%-image: IMAGE_NAME = hailgenetics/$(patsubst hailgenetics-%-image,%,$@):$(TOKEN)

hail-ubuntu-image: $(shell git ls-files docker/hail-ubuntu)
DOCKER_BUILD_ARGS='--build-arg DOCKER_PREFIX=$(DOCKER_PREFIX)' \
./docker-build.sh docker/hail-ubuntu Dockerfile $(IMAGE_NAME)
./docker-build.sh docker/hail-ubuntu Dockerfile $(IMAGE_NAME) --build-arg DOCKER_PREFIX=$(DOCKER_PREFIX)
echo $(IMAGE_NAME) > $@

base-image: hail-ubuntu-image docker/Dockerfile.base
DOCKER_BUILD_ARGS='--build-arg BASE_IMAGE='$$(cat hail-ubuntu-image) \
./docker-build.sh . docker/Dockerfile.base $(IMAGE_NAME)
./docker-build.sh . docker/Dockerfile.base $(IMAGE_NAME) --build-arg BASE_IMAGE=$(shell cat hail-ubuntu-image)
echo $(IMAGE_NAME) > $@

hail-run-image: base-image hail/Dockerfile.hail-run hail/python/pinned-requirements.txt hail/python/dev/pinned-requirements.txt docker/core-site.xml
$(MAKE) -C hail wheel
DOCKER_BUILD_ARGS='--build-arg BASE_IMAGE='$$(cat base-image) \
./docker-build.sh . hail/Dockerfile.hail-run $(IMAGE_NAME)
./docker-build.sh . hail/Dockerfile.hail-run $(IMAGE_NAME) --build-arg BASE_IMAGE=$(shell cat base-image)
echo $(IMAGE_NAME) > $@

hailgenetics-hail-image: hail-ubuntu-image docker/hailgenetics/hail/Dockerfile $(shell git ls-files hail/src/main hail/python)
$(MAKE) -C hail wheel
DOCKER_BUILD_ARGS='--build-arg BASE_IMAGE='$$(cat hail-ubuntu-image) \
./docker-build.sh . docker/hailgenetics/hail/Dockerfile $(IMAGE_NAME)
./docker-build.sh . docker/hailgenetics/hail/Dockerfile $(IMAGE_NAME) \
--build-arg BASE_IMAGE=$(shell cat hail-ubuntu-image)
echo $(IMAGE_NAME) > $@

hail-0.1-docs-5a6778710097.tar.gz:
Expand All @@ -191,18 +188,15 @@ docs.tar.gz: hail/build/www
website-image: docs.tar.gz

$(SERVICES_IMAGES): %-image: $(SERVICES_IMAGE_DEPS) $(shell git ls-files $$* ':!:**/deployment.yaml')
DOCKER_BUILD_ARGS='--build-arg BASE_IMAGE='$$(cat hail-ubuntu-image) \
./docker-build.sh . $*/Dockerfile $(IMAGE_NAME)
./docker-build.sh . $*/Dockerfile $(IMAGE_NAME) --build-arg BASE_IMAGE=$(shell cat hail-ubuntu-image)
echo $(IMAGE_NAME) > $@

ci-utils-image: base-image $(SERVICES_IMAGE_DEPS) $(shell git ls-files ci)
DOCKER_BUILD_ARGS='--build-arg BASE_IMAGE='$$(cat base-image) \
./docker-build.sh . ci/Dockerfile.ci-utils $(IMAGE_NAME)
./docker-build.sh . ci/Dockerfile.ci-utils $(IMAGE_NAME) --build-arg BASE_IMAGE=$(shell cat base-image)
echo $(IMAGE_NAME) > $@

hail-buildkit-image: ci/buildkit/Dockerfile
DOCKER_BUILD_ARGS='--build-arg DOCKER_PREFIX=$(DOCKER_PREFIX)' \
./docker-build.sh ci buildkit/Dockerfile $(IMAGE_NAME)
./docker-build.sh ci buildkit/Dockerfile $(IMAGE_NAME) --build-arg DOCKER_PREFIX=$(DOCKER_PREFIX)
echo $(IMAGE_NAME) > $@

batch/jvm-entryway/build/libs/jvm-entryway.jar: $(shell git ls-files batch/jvm-entryway)
Expand All @@ -214,13 +208,13 @@ batch-worker-image: batch/jvm-entryway/build/libs/jvm-entryway.jar $(SERVICES_IM
echo $(IMAGE_NAME) > $@

hailgenetics-vep-grch37-85-image: hail-ubuntu-image
DOCKER_BUILD_ARGS='--build-arg BASE_IMAGE='$$(cat hail-ubuntu-image) \
./docker-build.sh docker/vep docker/vep/grch37/85/Dockerfile $(IMAGE_NAME)
./docker-build.sh docker/vep docker/vep/grch37/85/Dockerfile $(IMAGE_NAME) \
--build-arg BASE_IMAGE=$(shell cat hail-ubuntu-image)
echo $(IMAGE_NAME) > $@

hailgenetics-vep-grch38-95-image: hail-ubuntu-image
DOCKER_BUILD_ARGS='--build-arg BASE_IMAGE='$$(cat hail-ubuntu-image) \
./docker-build.sh docker/vep docker/vep/grch38/95/Dockerfile $(IMAGE_NAME)
./docker-build.sh docker/vep docker/vep/grch38/95/Dockerfile $(IMAGE_NAME) \
--build-arg BASE_IMAGE=$(shell cat hail-ubuntu-image)
echo $(IMAGE_NAME) > $@

$(PRIVATE_REGISTRY_IMAGES): pushed-private-%-image: %-image
Expand Down
3 changes: 2 additions & 1 deletion docker-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ set -ex
CONTEXT="$(cd $1 && pwd)"
DOCKERFILE="$CONTEXT/$2"
IMAGE_NAME=$3
DOCKER_ARGS="${@:4}"

WITHOUT_TAG=$(echo $IMAGE_NAME | sed -E 's/(:[^:]+)(@[^@]+)?$//')
MAIN_CACHE=${WITHOUT_TAG}:cache
Expand All @@ -22,7 +23,7 @@ DOCKER_BUILDKIT=1 docker build \
--cache-from ${MAIN_CACHE} \
${DEV_CACHE:+--cache-from ${DEV_CACHE}} \
--build-arg BUILDKIT_INLINE_CACHE=1 \
${DOCKER_BUILD_ARGS} \
${DOCKER_ARGS} \
--tag ${IMAGE_NAME} \
--tag ${CACHE_IMAGE_NAME} \
${CONTEXT}

0 comments on commit 010ff09

Please sign in to comment.