22# Some uses for short name:
33# - Docker image name
44# - Kubernetes service, rc, pod, secret, volume names
5- SHORT_NAME : = builder
5+ SHORT_NAME ? = builder
66
77# Enable vendor/ directory support.
88export GO15VENDOREXPERIMENT =1
99
1010# SemVer with build information is defined in the SemVer 2 spec, but Docker
1111# doesn't allow +, so we use -.
12- # VERSION := 0.0.1-$(shell date "+%Y%m%d%H%M%S")
13-
14- VERSION := 2.0.0
12+ VERSION ?= 0.0.1-$(shell date "+% Y% m% d% H% M% S")
1513BINARY_DEST_DIR := rootfs/usr/bin
1614# Common flags passed into Go's linker.
1715LDFLAGS := "-s -X main.version=${VERSION}"
16+ IMAGE_PREFIX ?= deis
1817BINARIES := extract-domain extract-types extract-version generate-buildhook get-app-config get-app-values publish-release-controller yaml2json-procfile
1918STANDALONE := extract-types generate-buildhook yaml2json-procfile
2019# Docker Root FS
2120BINDIR := ./rootfs
2221
2322# Legacy support for DEV_REGISTRY, plus new support for DEIS_REGISTRY.
2423DEV_REGISTRY ?= $$DEV_REGISTRY
25- DEIS_REGISTY ?= ${DEV_REGISTRY}
24+ DEIS_REGISTRY ?= ${DEV_REGISTRY}/
2625
2726# Kubernetes-specific information for RC, Service, and Image.
2827RC := manifests/deis-${SHORT_NAME}-rc.yaml
2928SVC := manifests/deis-${SHORT_NAME}-service.yaml
30- # IMAGEBP := ${DEV_REGISTRY}/deis/bp${SHORT_NAME}:${VERSION}
31- IMAGE := smothiki/${SHORT_NAME}:${VERSION}
29+ IMAGE := ${DEIS_REGISTRY}${IMAGE_PREFIX}/${SHORT_NAME}:${VERSION}
3230
3331
3432all :
3533 @echo " Use a Makefile to control top-level building of the project."
3634
35+ bootstrap :
36+ glide up
37+
3738# This illustrates a two-stage Docker build. docker-compile runs inside of
3839# the Docker environment. Other alternatives are cross-compiling, doing
3940# the build as a `docker build`.
40-
4141build :
4242 GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -a -installsuffix cgo -ldflags ' -s' -o $(BINARY_DEST_DIR ) /builder boot.go || exit 1
4343 GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -a -installsuffix cgo -ldflags ' -s' -o $(BINARY_DEST_DIR ) /fetcher fetcher/fetcher.go || exit 1
@@ -46,19 +46,16 @@ build:
4646 for i in $( BINARIES) ; do \
4747 GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -a -installsuffix cgo -ldflags ' -s' -o $(BINARY_DEST_DIR ) /$$ i pkg/src/$$ i.go || exit 1; \
4848 done
49- @echo " Past go compiling"
5049 @for i in $(BINARIES ) ; do \
5150 $(call check-static-binary,$(BINARY_DEST_DIR ) /$$i) ; \
5251 done
5352
54- docker-build :
55- docker build -t $(IMAGE ) rootfs
53+ docker-build : build
54+ docker build --rm - t $(IMAGE ) rootfs
5655 perl -pi -e " s|image: [a-z0-9.:]+\/deis\/bp${SHORT_NAME} :[0-9a-z-.]+|image: ${IMAGE} |g" ${RC}
57- # For cases where build is run inside of a container.
58-
5956
6057# Push to a registry that Kubernetes can access.
61- docker-push-bp :
58+ docker-push :
6259 docker push ${IMAGE}
6360
6461# Deploy is a Kubernetes-oriented target
@@ -76,6 +73,9 @@ kube-rc:
7673kube-clean :
7774 kubectl delete rc deis-builder
7875
76+ test :
77+ @echo " Implement functional tests in _tests directory"
78+
7979.PHONY : all build docker-compile kube-up kube-down deploy
8080
8181define check-static-binary
0 commit comments