[ci skip] Add docker_production method for build

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
Bo-Yi Wu 2016-05-22 22:28:57 +08:00
parent cbb05c8afa
commit 1cca70c296
1 changed files with 5 additions and 3 deletions

View File

@ -2,7 +2,7 @@
DEPS := $(wildcard *.go) DEPS := $(wildcard *.go)
BUILD_IMAGE := "gorush-build" BUILD_IMAGE := "gorush-build"
PRODUCTION_IMAGE := "gorush" PRODUCTION_IMAGE := "gorush-production"
DEPLOY_ACCOUNT := "appleboy" DEPLOY_ACCOUNT := "appleboy"
VERSION := $(shell git describe --tags) VERSION := $(shell git describe --tags)
RANDOM := $(shell date '+%Y%m%d%H%M%S%s') RANDOM := $(shell date '+%Y%m%d%H%M%S%s')
@ -46,13 +46,15 @@ docker_build: clean
sed -e "s/#VERSION#/$(VERSION)/g" docker/Dockerfile.build > docker/Dockerfile.tmp sed -e "s/#VERSION#/$(VERSION)/g" docker/Dockerfile.build > docker/Dockerfile.tmp
docker build --rm -t $(BUILD_IMAGE) -f docker/Dockerfile.tmp . docker build --rm -t $(BUILD_IMAGE) -f docker/Dockerfile.tmp .
docker run --rm $(BUILD_IMAGE) > gorush.tar.gz docker run --rm $(BUILD_IMAGE) > gorush.tar.gz
docker build --rm -t $(PRODUCTION_IMAGE) -f docker/Dockerfile.dist .
docker_test: init docker_test: init
docker-compose -p ${RANDOM} -f docker/docker-compose.testing.yml run --rm gorush docker-compose -p ${RANDOM} -f docker/docker-compose.testing.yml run --rm gorush
docker-compose -p ${RANDOM} -f docker/docker-compose.testing.yml down docker-compose -p ${RANDOM} -f docker/docker-compose.testing.yml down
deploy: docker_production: docker_build
docker build --rm -t $(PRODUCTION_IMAGE) -f docker/Dockerfile.dist .
deploy: docker_production
ifeq ($(tag),) ifeq ($(tag),)
@echo "Usage: make $@ tag=<tag>" @echo "Usage: make $@ tag=<tag>"
@exit 1 @exit 1