Rewrite docker testing.

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
Bo-Yi Wu 2016-05-19 21:34:17 +08:00
parent a918e55b6a
commit 87320ed011
5 changed files with 30 additions and 20 deletions

View File

@ -1,16 +0,0 @@
FROM golang:1.6.2-alpine
MAINTAINER Bo-Yi Wu <appleboy.tw@gmail.com>
RUN apk update \
&& apk add git make && rm -rf /var/cache/apk/*
# install glide package management.
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 git clone https://github.com/appleboy/gorush.git $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" gorush/status_test.go
RUN sed -i"" -e "s/localhost/redis/g" storage/redis/redis_test.go
RUN make bundle

View File

@ -1,14 +1,15 @@
gorush:
build: "."
dockerfile: Dockerfile.testing
build: ./golang
links:
- redis
privileged: true
environment:
- ANDROID_API_KEY
- ANDROID_TEST_TOKEN
command: /bin/sh -c "make test"
volumes:
- ../:/go/src/github.com/appleboy/gorush
command: /bin/sh -c './docker/testing.sh'
redis:
image: redis:alpine
build: ./redis
privileged: true

11
docker/golang/Dockerfile Normal file
View File

@ -0,0 +1,11 @@
FROM golang:1.6.2-alpine
MAINTAINER Bo-Yi Wu <appleboy.tw@gmail.com>
RUN apk update \
&& apk add git make && rm -rf /var/cache/apk/*
# install glide package management.
RUN go get github.com/Masterminds/glide && cd $GOPATH/src/github.com/Masterminds/glide && make install
WORKDIR $GOPATH/src/github.com/appleboy/gorush

7
docker/redis/Dockerfile Normal file
View File

@ -0,0 +1,7 @@
FROM redis:alpine
MAINTAINER Bo-Yi Wu <appleboy.tw@gmail.com>
CMD [ "redis-server" ]
EXPOSE 6379

7
docker/testing.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/sh
#
cd /go/src/github.com/appleboy/gorush
sed -i"" -e "s/localhost/redis/g" config/config.yml
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