github.com/kubeflow/training-operator@v1.7.0/examples/tensorflow/tf_sample/Makefile (about) 1 IMG = gcr.io/kubeflow-examples/tf_smoke 2 3 # List any changed files. We only include files in the notebooks directory. 4 # because that is the code in the docker image. 5 # In particular we exclude changes to the ksonnet configs. 6 CHANGED_FILES := $(shell git diff-files --relative=tensorflow/tf_sample) 7 8 ifeq ($(strip $(CHANGED_FILES)),) 9 # Changed files is empty; not dirty 10 # Don't include --dirty because it could be dirty if files outside the ones we care 11 # about changed. 12 GIT_VERSION := $(shell git describe --always) 13 else 14 GIT_VERSION := $(shell git describe --always)-dirty-$(shell git diff | shasum -a256 | cut -c -6) 15 endif 16 17 TAG := $(shell date +v%Y%m%d)-$(GIT_VERSION) 18 all: build 19 20 # To build without the cache set the environment variable 21 # export DOCKER_BUILD_OPTS=--no-cache 22 build: 23 docker build ${DOCKER_BUILD_OPTS} -t $(IMG):$(TAG) . \ 24 --label=git-verions=$(GIT_VERSION) 25 docker tag $(IMG):$(TAG) $(IMG):latest 26 @echo Built $(IMG):latest 27 @echo Built $(IMG):$(TAG) 28 29 30 # Build but don't attach the latest tag. This allows manual testing/inspection of the image 31 # first. 32 push: build 33 gcloud docker -- push $(IMG):$(TAG) 34 @echo Pushed $(IMG) with :$(TAG) tags 35 36 push-latest: push 37 gcloud container images add-tag --quiet $(IMG):$(TAG) $(IMG):latest --verbosity=info 38 echo created $(IMG):latest