support docker compose testing.
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
parent
9a2459af06
commit
d97ed3457f
11
Makefile
11
Makefile
|
@ -5,7 +5,7 @@ BUILD_IMAGE := "gorush-build"
|
||||||
PRODUCTION_IMAGE := "gorush"
|
PRODUCTION_IMAGE := "gorush"
|
||||||
DEPLOY_ACCOUNT := "appleboy"
|
DEPLOY_ACCOUNT := "appleboy"
|
||||||
VERSION := $(shell git describe --tags)
|
VERSION := $(shell git describe --tags)
|
||||||
TIMENAME := $(shell date '+%Y%m%d%H%M%S%s')
|
PROJECT := $(shell date '+%Y%m%d%H%M%S%s')
|
||||||
|
|
||||||
all: build
|
all: build
|
||||||
|
|
||||||
|
@ -38,11 +38,8 @@ docker_build: clean
|
||||||
docker build --rm -t $(PRODUCTION_IMAGE) -f docker/Dockerfile.dist .
|
docker build --rm -t $(PRODUCTION_IMAGE) -f docker/Dockerfile.dist .
|
||||||
|
|
||||||
docker_test:
|
docker_test:
|
||||||
@docker build --rm -t $(TIMENAME)-test -f docker/Dockerfile.testing .
|
docker-compose -p ${PROJECT} -f docker/docker-compose.testing.yml run --rm gorush
|
||||||
@docker run --name $(TIMENAME)-redis -d redis
|
docker-compose -p ${PROJECT} -f docker/docker-compose.testing.yml down
|
||||||
@docker run --rm --link $(TIMENAME)-redis:redis -e ANDROID_TEST_TOKEN=$(ANDROID_TEST_TOKEN) -e ANDROID_API_KEY=$(ANDROID_API_KEY) $(TIMENAME)-test sh -c "make test"
|
|
||||||
@docker rm -f $(TIMENAME)-redis
|
|
||||||
@docker rmi -f $(TIMENAME)-test
|
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
ifeq ($(tag),)
|
ifeq ($(tag),)
|
||||||
|
@ -62,4 +59,4 @@ lint:
|
||||||
golint gorush
|
golint gorush
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
-rm -rf build.tar.gz gorush.tar.gz bin/*
|
-rm -rf build.tar.gz gorush.tar.gz bin/* coverage.out gorush.tar.gz
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
FROM golang:1.6
|
FROM golang:1.6.2-alpine
|
||||||
|
|
||||||
MAINTAINER Bo-Yi Wu <appleboy.tw@gmail.com>
|
MAINTAINER Bo-Yi Wu <appleboy.tw@gmail.com>
|
||||||
|
|
||||||
|
RUN apk update \
|
||||||
|
&& apk add git make && rm -rf /var/cache/apk/*
|
||||||
|
|
||||||
# install glide package management.
|
# install glide package management.
|
||||||
RUN go get github.com/Masterminds/glide && cd $GOPATH/src/github.com/Masterminds/glide && make install
|
RUN go get github.com/Masterminds/glide && cd $GOPATH/src/github.com/Masterminds/glide && make install
|
||||||
RUN mkdir -p $GOPATH/src/github.com/appleboy/gorush
|
RUN mkdir -p $GOPATH/src/github.com/appleboy/gorush
|
||||||
Add . $GOPATH/src/github.com/appleboy/gorush/
|
RUN git clone https://github.com/appleboy/gorush.git $GOPATH/src/github.com/appleboy/gorush/
|
||||||
WORKDIR $GOPATH/src/github.com/appleboy/gorush
|
WORKDIR $GOPATH/src/github.com/appleboy/gorush
|
||||||
RUN sed -i"" -e "s/localhost/redis/g" config/config.yml
|
RUN sed -i"" -e "s/localhost/redis/g" config/config.yml
|
||||||
RUN sed -i"" -e "s/localhost/redis/g" gorush/status_test.go
|
RUN sed -i"" -e "s/localhost/redis/g" gorush/status_test.go
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
gorush:
|
||||||
|
build: "."
|
||||||
|
dockerfile: Dockerfile.testing
|
||||||
|
links:
|
||||||
|
- redis
|
||||||
|
privileged: true
|
||||||
|
environment:
|
||||||
|
- ANDROID_API_KEY
|
||||||
|
- ANDROID_TEST_TOKEN
|
||||||
|
command: /bin/sh -c "make test"
|
||||||
|
|
||||||
|
redis:
|
||||||
|
image: redis:alpine
|
||||||
|
privileged: true
|
Loading…
Reference in New Issue