Created
October 9, 2017 19:12
-
-
Save smothiki/0d30283e72b66e109e6af705e94f5209 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SHORT_NAME ?= weebly | |
# dockerized development environment variables | |
REPO_PATH := github.com/smothiki/${SHORT_NAME} | |
DEV_ENV_IMAGE := golang:1.7#blang/golang-alpine | |
DEV_ENV_WORK_DIR := /go/src/${REPO_PATH} | |
DEV_ENV_PREFIX := docker run --rm -v ${CURDIR}:${DEV_ENV_WORK_DIR} -w ${DEV_ENV_WORK_DIR} #-e GOVENDOREXPERIMENT=1 | |
DEV_ENV_CMD := ${DEV_ENV_PREFIX} ${DEV_ENV_IMAGE} | |
DEV_GLIDE_CMD := ${DEV_ENV_PREFIX} quay.io/deis/go-dev:0.17.0 | |
# SemVer with build information is defined in the SemVer 2 spec, but Docker | |
# doesn't allow +, so we use -. | |
BINARY_DEST_DIR := rootfs/usr/bin | |
# Common flags passed into Go's linker. | |
LDFLAGS := "-s -w -X main.version=${VERSION}" | |
# Docker Root FS | |
BINDIR := ./rootfs | |
GOTEST := go test --race | |
bootstrap: | |
${DEV_GLIDE_CMD} glide install | |
glideinit: | |
${DEV_GLIDE_CMD} glide init | |
glideup: | |
${DEV_GLIDE_CMD} glide up | |
build-server: | |
${DEV_ENV_CMD} go build -ldflags ${LDFLAGS} -o ${BINARY_DEST_DIR}/server webserver/server.go | |
build-dbinit: | |
${DEV_ENV_CMD} go build -ldflags ${LDFLAGS} -o ${BINARY_DEST_DIR}/dbint dbinit.go | |
build-subs: | |
${DEV_ENV_CMD} go build -ldflags ${LDFLAGS} -o ${BINARY_DEST_DIR}/subs subscriber/subscriber.go | |
test: test-style test-unit | |
test-style: | |
${DEV_ENV_CMD} lint | |
test-unit: | |
${DEV_ENV_CMD} sh -c '${GOTEST} $$(glide nv)' | |
docker-build-server: build-server | |
docker build --rm -t smothiki/weeblyserver rootfs | |
docker-build-pod: build-dbinit | |
docker build --rm -t smothiki/dbinti rootfs | |
docker-build: build-server build-dbinit build-subs | |
docker build --rm -t smothiki/weeblyapp:3 rootfs | |
deploy: | |
kubectl create -f manifests/servicesecret.yaml | |
kubectl create -f manifests/weebly_service.yaml | |
kubectl create -f manifests/weebly_res.yaml |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment