From 4c5d482ff68112fc18503cee5eff7a9022cf0538 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Tue, 19 Jul 2016 22:20:23 +0800 Subject: [PATCH] fix docker testing Signed-off-by: Bo-Yi Wu --- Makefile | 1 + docker/Dockerfile.build | 5 ++--- docker/testing.sh | 7 ++++++- glide.lock | 4 ++-- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 21da4f5..79ce6a8 100644 --- a/Makefile +++ b/Makefile @@ -67,6 +67,7 @@ endif docker push $(DEPLOY_ACCOUNT)/$(PRODUCTION_IMAGE):$(tag) install: + @which glide || (curl https://glide.sh/get | sh) @glide install update: diff --git a/docker/Dockerfile.build b/docker/Dockerfile.build index 575ac26..79f2f34 100644 --- a/docker/Dockerfile.build +++ b/docker/Dockerfile.build @@ -3,12 +3,11 @@ FROM golang:1.6.2-alpine MAINTAINER Bo-Yi Wu ENV VERSION #VERSION# -RUN apk --update add git make -RUN go get github.com/Masterminds/glide && cd $GOPATH/src/github.com/Masterminds/glide && make install +RUN apk --update add git make curl RUN mkdir -p $GOPATH/src/github.com/appleboy/gorush Add build.tar.gz $GOPATH/src/github.com/appleboy/gorush/ WORKDIR $GOPATH/src/github.com/appleboy/gorush -RUN make bundle +RUN make install RUN GOOS=linux GOARCH=amd64 go build -ldflags="-s -w -X main.Version=${VERSION}" -o bin/gorush gorush.go CMD tar -C bin -czf - gorush diff --git a/docker/testing.sh b/docker/testing.sh index 215ba5d..52951ff 100755 --- a/docker/testing.sh +++ b/docker/testing.sh @@ -1,7 +1,12 @@ #!/bin/sh # + +set -e + cd ${GOPATH}/src/github.com/appleboy/gorush sed -i"" -e "s/localhost/redis/g" config/config.yml +sed -i"" -e "s/localhost/redis/g" config/config.go +sed -i"" -e "s/localhost/redis/g" config/config_test.go sed -i"" -e "s/localhost/redis/g" gorush/status_test.go sed -i"" -e "s/localhost/redis/g" storage/redis/redis_test.go -make bundle && make test +make install && make test diff --git a/glide.lock b/glide.lock index 9847328..5308f0d 100644 --- a/glide.lock +++ b/glide.lock @@ -1,8 +1,8 @@ hash: d182f8dc3162313af09e706a0ba4901218d9ccde609ee7d39c6aae5e891f20ee -updated: 2016-07-19T15:42:04.799126082+08:00 +updated: 2016-07-19T21:31:48.923940945+08:00 imports: - name: github.com/appleboy/gorush - version: 5b2018147493092e5f15f2f9e42142acf0eebc51 + version: af78db59b4675cf932aaa71fd45443ac9283bce7 subpackages: - config - gorush