|
| 1 | +include includes.mk |
| 2 | + |
| 3 | +# Short name: Short name, following [a-zA-Z_], used all over the place. |
| 4 | +# Some uses for short name: |
| 5 | +# - Docker image name |
| 6 | +# - Kubernetes service, rc, pod, secret, volume names |
| 7 | +SHORT_NAME := registry |
| 8 | + |
| 9 | +BUILD_TAG ?= git-$(shell git rev-parse --short HEAD) |
| 10 | + |
| 11 | +# Legacy support for DEV_REGISTRY, plus new support for DEIS_REGISTRY. |
| 12 | +DEIS_REGISTRY ?= ${DEV_REGISTRY} |
| 13 | + |
| 14 | +IMAGE_PREFIX ?= deis/ |
| 15 | + |
| 16 | +# Kubernetes-specific information for RC, Service, and Image. |
| 17 | +RC := contrib/kubernetes/manifests/${SHORT_NAME}-rc.tmp.yaml |
| 18 | +SVC := contrib/kubernetes/manifests/${SHORT_NAME}-service.yaml |
| 19 | +IMAGE := ${DEIS_REGISTRY}/${IMAGE_PREFIX}${SHORT_NAME}:${BUILD_TAG} |
| 20 | + |
| 21 | +all: |
| 22 | + @echo "Use a Makefile to control top-level building of the project." |
| 23 | + |
| 24 | +build: |
| 25 | + @echo "Nothing to build. Use 'make docker-build' to build the image." |
| 26 | + |
| 27 | +# For cases where we're building from local |
| 28 | +# We also alter the RC file to set the image name. |
| 29 | +docker-build: check-docker |
| 30 | + docker build --rm -t ${IMAGE} rootfs |
| 31 | + |
| 32 | +# Push to a registry that Kubernetes can access. |
| 33 | +docker-push: check-docker check-registry |
| 34 | + docker push ${IMAGE} |
| 35 | + |
| 36 | +# Deploy is a Kubernetes-oriented target |
| 37 | +deploy: kube-service kube-rc |
| 38 | + |
| 39 | +# Some things, like services, have to be deployed before pods. This is an |
| 40 | +# example target. Others could perhaps include kube-secret, kube-volume, etc. |
| 41 | +kube-service: check-kubectl |
| 42 | + kubectl create -f ${SVC} |
| 43 | + |
| 44 | +# When possible, we deploy with RCs. |
| 45 | +kube-rc: check-kubectl |
| 46 | + kubectl create -f ${RC} |
| 47 | + |
| 48 | +kube-clean: check-kubectl |
| 49 | + kubectl delete rc ${SHORT_NAME} |
| 50 | + |
| 51 | +test: check-docker |
| 52 | + contrib/ci/test.sh ${IMAGE} |
| 53 | + |
| 54 | +update-manifests: |
| 55 | + sed 's#\(image:\) .*#\1 $(IMAGE)#' contrib/kubernetes/manifests/${SHORT_NAME}-rc.yaml \ |
| 56 | + > ${RC} |
| 57 | + |
| 58 | +.PHONY: all build kube-up kube-down deploy |
0 commit comments