Merge pull request #121 from appleboy/scratch
Support scratch container.
This commit is contained in:
commit
e1c94968fb
|
@ -39,8 +39,6 @@ script:
|
||||||
after_success:
|
after_success:
|
||||||
- test "$TRAVIS_BRANCH" == "master" && test "$TRAVIS_GO_VERSION" == "1.6.3"
|
- test "$TRAVIS_BRANCH" == "master" && test "$TRAVIS_GO_VERSION" == "1.6.3"
|
||||||
&& test "$TRAVIS_PULL_REQUEST" == "false" && docker login -e="$DOCKER_EMAIL" -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
|
&& test "$TRAVIS_PULL_REQUEST" == "false" && docker login -e="$DOCKER_EMAIL" -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
|
||||||
- test "$TRAVIS_BRANCH" == "master" && test "$TRAVIS_GO_VERSION" == "1.6.3"
|
|
||||||
&& test "$TRAVIS_PULL_REQUEST" == "false" && cd $TRAVIS_BUILD_DIR && make docker_build
|
|
||||||
- test "$TRAVIS_BRANCH" == "master" && test "$TRAVIS_GO_VERSION" == "1.6.3"
|
- test "$TRAVIS_BRANCH" == "master" && test "$TRAVIS_GO_VERSION" == "1.6.3"
|
||||||
&& test "$TRAVIS_PULL_REQUEST" == "false" && cd $TRAVIS_BUILD_DIR && make deploy tag=latest
|
&& test "$TRAVIS_PULL_REQUEST" == "false" && cd $TRAVIS_BUILD_DIR && make deploy tag=latest
|
||||||
- bash <(curl -s https://codecov.io/bash) -f .cover/coverage.txt
|
- bash <(curl -s https://codecov.io/bash) -f .cover/coverage.txt
|
||||||
|
|
21
Makefile
21
Makefile
|
@ -9,6 +9,12 @@ VERSION := $(shell git describe --tags)
|
||||||
TARGETS_NOVENDOR := $(shell glide novendor)
|
TARGETS_NOVENDOR := $(shell glide novendor)
|
||||||
export PROJECT_PATH = /go/src/github.com/appleboy/gorush
|
export PROJECT_PATH = /go/src/github.com/appleboy/gorush
|
||||||
|
|
||||||
|
ifneq ($(shell uname), Darwin)
|
||||||
|
EXTLDFLAGS = -extldflags "-static" $(null)
|
||||||
|
else
|
||||||
|
EXTLDFLAGS =
|
||||||
|
endif
|
||||||
|
|
||||||
all: build
|
all: build
|
||||||
|
|
||||||
init:
|
init:
|
||||||
|
@ -28,6 +34,9 @@ install:
|
||||||
update:
|
update:
|
||||||
glide update
|
glide update
|
||||||
|
|
||||||
|
build_static:
|
||||||
|
go build -ldflags="${EXTLDFLAGS}-s -w -X main.Version=${VERSION}" -o bin/gorush gorush.go
|
||||||
|
|
||||||
build: clean
|
build: clean
|
||||||
sh script/build.sh $(VERSION)
|
sh script/build.sh $(VERSION)
|
||||||
|
|
||||||
|
@ -58,14 +67,10 @@ docker_build: clean
|
||||||
docker build --rm -t $(BUILD_IMAGE) -f docker/Dockerfile.tmp .
|
docker build --rm -t $(BUILD_IMAGE) -f docker/Dockerfile.tmp .
|
||||||
docker run --rm $(BUILD_IMAGE) > gorush.tar.gz
|
docker run --rm $(BUILD_IMAGE) > gorush.tar.gz
|
||||||
|
|
||||||
docker_test: init clean
|
docker_production:
|
||||||
docker-compose -p ${PRODUCTION_IMAGE} -f docker/docker-compose.testing.yml run gorush
|
|
||||||
docker-compose -p ${PRODUCTION_IMAGE} -f docker/docker-compose.testing.yml down
|
|
||||||
|
|
||||||
docker_production: docker_build
|
|
||||||
docker build --rm -t $(PRODUCTION_IMAGE) -f docker/Dockerfile.dist .
|
docker build --rm -t $(PRODUCTION_IMAGE) -f docker/Dockerfile.dist .
|
||||||
|
|
||||||
deploy: docker_production
|
deploy: docker_build docker_production
|
||||||
ifeq ($(tag),)
|
ifeq ($(tag),)
|
||||||
@echo "Usage: make $@ tag=<tag>"
|
@echo "Usage: make $@ tag=<tag>"
|
||||||
@exit 1
|
@exit 1
|
||||||
|
@ -73,6 +78,10 @@ endif
|
||||||
docker tag $(PRODUCTION_IMAGE):latest $(DEPLOY_ACCOUNT)/$(PRODUCTION_IMAGE):$(tag)
|
docker tag $(PRODUCTION_IMAGE):latest $(DEPLOY_ACCOUNT)/$(PRODUCTION_IMAGE):$(tag)
|
||||||
docker push $(DEPLOY_ACCOUNT)/$(PRODUCTION_IMAGE):$(tag)
|
docker push $(DEPLOY_ACCOUNT)/$(PRODUCTION_IMAGE):$(tag)
|
||||||
|
|
||||||
|
docker_test: init clean
|
||||||
|
docker-compose -p ${PRODUCTION_IMAGE} -f docker/docker-compose.testing.yml run gorush
|
||||||
|
docker-compose -p ${PRODUCTION_IMAGE} -f docker/docker-compose.testing.yml down
|
||||||
|
|
||||||
fmt:
|
fmt:
|
||||||
@echo $(TARGETS_NOVENDOR) | xargs go fmt
|
@echo $(TARGETS_NOVENDOR) | xargs go fmt
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,6 @@ RUN mkdir -p $GOPATH/src/github.com/appleboy/gorush
|
||||||
Add build.tar.gz $GOPATH/src/github.com/appleboy/gorush/
|
Add build.tar.gz $GOPATH/src/github.com/appleboy/gorush/
|
||||||
WORKDIR $GOPATH/src/github.com/appleboy/gorush
|
WORKDIR $GOPATH/src/github.com/appleboy/gorush
|
||||||
RUN make install
|
RUN make install
|
||||||
RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="-s -w -X main.Version=${VERSION}" -o bin/gorush gorush.go
|
RUN CGO_ENABLED=0 make build_static
|
||||||
|
|
||||||
CMD tar -C bin -czf - gorush
|
CMD tar -C bin -czf - gorush
|
||||||
|
|
|
@ -1,14 +1,9 @@
|
||||||
FROM alpine
|
FROM centurylink/ca-certs
|
||||||
|
|
||||||
MAINTAINER Bo-Yi Wu <appleboy.tw@gmail.com>
|
|
||||||
|
|
||||||
RUN apk update && apk upgrade \
|
|
||||||
&& apk add ca-certificates \
|
|
||||||
&& rm -rf /var/cache/apk/*
|
|
||||||
|
|
||||||
RUN mkdir /app
|
|
||||||
ADD gorush.tar.gz /app/
|
|
||||||
ADD config/config.yml /app/config/
|
|
||||||
WORKDIR /app
|
|
||||||
ENTRYPOINT ["./gorush", "-c", "config/config.yml"]
|
|
||||||
EXPOSE 8088
|
EXPOSE 8088
|
||||||
|
|
||||||
|
ADD config/config.yml /
|
||||||
|
|
||||||
|
ADD gorush.tar.gz /
|
||||||
|
|
||||||
|
ENTRYPOINT ["/gorush"]
|
||||||
|
CMD ["-c", "config.yml"]
|
||||||
|
|
|
@ -10,7 +10,7 @@ for GOOS in $OS; do
|
||||||
(test "$GOOS" = "windows") && EXE="gorush.exe"
|
(test "$GOOS" = "windows") && EXE="gorush.exe"
|
||||||
|
|
||||||
echo "Build: ${GOOS}, Arch: ${GOARCH}, EXE: ${EXE}"
|
echo "Build: ${GOOS}, Arch: ${GOARCH}, EXE: ${EXE}"
|
||||||
GOOS=$GOOS GOARCH=$GOARCH go build -ldflags="-s -w -X main.Version=${VERSION}" -o bin/$GOOS/$GOARCH/${EXE} gorush.go;
|
GOOS=$GOOS GOARCH=$GOARCH CGO_ENABLED=0 go build -ldflags="-s -w -X main.Version=${VERSION}" -o bin/$GOOS/$GOARCH/${EXE} gorush.go;
|
||||||
tar -C bin/$GOOS/$GOARCH -czf bin/gorush-$VERSION-$GOOS-$GOARCH.tar.gz gorush
|
tar -C bin/$GOOS/$GOARCH -czf bin/gorush-$VERSION-$GOOS-$GOARCH.tar.gz gorush
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in New Issue