Merge pull request #84 from appleboy/docker

Fixed #82 Support docker compose for concurrent build.
This commit is contained in:
Bo-Yi Wu 2016-05-11 04:13:20 -05:00
commit 504dedf464
3 changed files with 24 additions and 9 deletions

View File

@ -2,10 +2,10 @@
DEPS := $(wildcard *.go)
BUILD_IMAGE := "gorush-build"
TEST_IMAGE := "gorush-testing"
PRODUCTION_IMAGE := "gorush"
DEPLOY_ACCOUNT := "appleboy"
VERSION := $(shell git describe --tags)
PROJECT := $(shell date '+%Y%m%d%H%M%S%s')
all: build
@ -38,11 +38,9 @@ docker_build: clean
docker build --rm -t $(PRODUCTION_IMAGE) -f docker/Dockerfile.dist .
docker_test:
-docker rm -f gorush-redis
@docker build --rm -t $(TEST_IMAGE) -f docker/Dockerfile.testing .
@docker run --name gorush-redis -d redis
@docker run --rm --link gorush-redis:redis -e ANDROID_TEST_TOKEN=$(ANDROID_TEST_TOKEN) -e ANDROID_API_KEY=$(ANDROID_API_KEY) $(TEST_IMAGE) sh -c "make test"
@docker rm -f gorush-redis
docker-compose -p ${PROJECT} -f docker/docker-compose.testing.yml build --no-cache gorush
docker-compose -p ${PROJECT} -f docker/docker-compose.testing.yml run --rm gorush
docker-compose -p ${PROJECT} -f docker/docker-compose.testing.yml down
deploy:
ifeq ($(tag),)
@ -62,4 +60,4 @@ lint:
golint gorush
clean:
-rm -rf build.tar.gz gorush.tar.gz bin/*
-rm -rf build.tar.gz gorush.tar.gz bin/* coverage.out gorush.tar.gz

View File

@ -1,11 +1,14 @@
FROM golang:1.6
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
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
RUN sed -i"" -e "s/localhost/redis/g" config/config.yml
RUN sed -i"" -e "s/localhost/redis/g" gorush/status_test.go

View File

@ -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