Skip to content

Commit

Permalink
✨Enhance (docker) image push capabilities in the Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
Borie, Niels committed Mar 4, 2024
1 parent 4c84977 commit fc5e4e5
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,16 @@ help: ## Display this help
build-all-images: ## Build all machine-learning-environments docker images
@for version in $(SUPPORTED_PYTHON_VERSIONS); do \
for layer in $(ALL_LAYERS); do \
$(MAKE) build-image PYTHON_VERSION=$$version LAYER=$$layer IMAGE_VERSION=$(IMAGE_VERSION); \
for builder in $(ALL_BUILDERS); do \
$(MAKE) build-image PYTHON_VERSION=$$version LAYER=$$layer BUILDER=$$builder IMAGE_VERSION=$(IMAGE_VERSION); \
done \
done \
done

push-all-images: ## push all machine-learning-environments docker images
@for version in $(SUPPORTED_PYTHON_VERSIONS); do \
for layer in $(ALL_LAYERS); do \
$(MAKE) push-image PYTHON_VERSION=$$version LAYER=$$layer IMAGE_VERSION=$(IMAGE_VERSION); \
done \
done

Expand All @@ -51,12 +60,14 @@ build-image: ## Build a single machine-learning-environments docker image (args
docker build --progress=plain --no-cache --force-rm -t $(REGISTRY_URL)/$(LAYER)-$(BUILDER)-py$(PYTHON_VERSION):$(IMAGE_VERSION) --build-arg PYTHON_RELEASE_VERSION=$$real_python_version --build-arg PYTHON_VERSION=$(PYTHON_VERSION) --build-arg IMAGE_VERSION=$(IMAGE_VERSION) --build-arg BUILDER=$(BUILDER) -f layers/$(LAYER)/$(BUILDER).Dockerfile layers/$(LAYER)/


docker-push: ## Push machine-learning-environments image to registry (args : PYTHON_VERSION, LAYER, BUILDER, IMAGE_VERSION)
push-image: ## Push machine-learning-environments image to registry (args : PYTHON_VERSION, LAYER, BUILDER, IMAGE_VERSION)
docker push $(REGISTRY_URL)/$(LAYER)-$(BUILDER)-py$(PYTHON_VERSION):$(IMAGE_VERSION)
if [ "${BRANCH_NAME}" = "main" ]; then \
docker push $(REGISTRY_URL)/$(LAYER)-$(BUILDER)-py$(PYTHON_VERSION):latest; \
fi;



### Running environments ###
docker-run: ## Run machine-learning-environments using docker image (args : PYTHON_VERSION, LAYER, BUILDER, IMAGE_VERSION)
docker run --rm -it -d --name ML-env $(REGISTRY_URL)/$(LAYER)-$(BUILDER)-py$(PYTHON_VERSION):$(IMAGE_VERSION)
Expand Down

0 comments on commit fc5e4e5

Please sign in to comment.