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