gorush/Makefile

40 lines
1012 B
Makefile

.PHONY: all
DEPS := $(wildcard *.go)
BUILD_IMAGE := "gorush-build"
TEST_IMAGE := "gorush-testing"
PRODUCTION_IMAGE := "gorush"
DEPLOY_ACCOUNT := "appleboy"
all: build
build: clean
sh script/build.sh
test:
cd gorush && go test -cover -v ./...
docker_build: clean
tar -zcvf build.tar.gz gorush.go gorush
docker build --rm -t $(BUILD_IMAGE) -f docker/Dockerfile.build .
docker run --rm $(BUILD_IMAGE) > gorush.tar.gz
docker build --rm -t $(PRODUCTION_IMAGE) -f docker/Dockerfile.dist .
docker_test:
@docker build --rm -t $(TEST_IMAGE) -f docker/Dockerfile.testing .
@docker run --rm -e ANDROID_TEST_TOKEN=$(ANDROID_TEST_TOKEN) -e ANDROID_API_KEY=$(ANDROID_API_KEY) $(TEST_IMAGE) sh -c "cd gorush && go test -v"
deploy:
ifeq ($(tag),)
@echo "Usage: make $@ tag=<tag>"
@exit 1
endif
docker tag -f $(PRODUCTION_IMAGE):latest $(DEPLOY_ACCOUNT)/$(PRODUCTION_IMAGE):$(tag)
docker push $(DEPLOY_ACCOUNT)/$(PRODUCTION_IMAGE):$(tag)
lint:
golint gorush
clean:
-rm -rf build.tar.gz gorush.tar.gz bin/*