0
0
mirror of https://github.com/letic/Shell-Scripts.git synced 2024-09-27 21:46:03 +00:00
AWS_Shell-Scripts/ci/build-go-app.sh

32 lines
991 B
Bash
Raw Normal View History

2016-04-26 15:42:50 +00:00
if [ $(cat status) -eq 1 ]; then
exit
fi
2016-04-25 16:18:21 +00:00
printf "\nPull Golang Container 1.6.2\n\n"
2016-04-26 15:42:50 +00:00
CONTAINER_WS=/gopath/src/github.com/bbc/mozart-requester/src
2016-04-25 16:18:21 +00:00
docker pull golang:1.6.2
2016-04-26 15:42:50 +00:00
printf "\nInstall Dependencies and Run Tests\n\n"
2016-04-25 16:18:21 +00:00
2016-05-03 14:40:45 +00:00
docker run --rm=true -v $WORKSPACE/src:$CONTAINER_WS -e "GOPATH=/gopath" -e "APP_ENV=test" -w $CONTAINER_WS golang:1.6.2 \
2016-04-26 15:42:50 +00:00
sh -c 'go get github.com/Masterminds/glide && /gopath/bin/glide install && go test $(/gopath/bin/glide novendor)'
2016-04-25 16:18:21 +00:00
printf "\nCompile Application Binary\n\n"
docker run --rm=true -v $WORKSPACE/src:$CONTAINER_WS -e "GOPATH=/gopath" -w $CONTAINER_WS golang:1.6.2 \
2016-04-26 15:42:50 +00:00
sh -c 'CGO_ENABLED=0 go build -a --installsuffix cgo --ldflags=\"-s\" -o mozart-requester'
2016-04-25 16:18:21 +00:00
printf "\nMove Binary to SOURCES\n\n"
2016-04-26 15:42:50 +00:00
mv src/mozart-requester SOURCES
printf "\nPull MBT Container\n\n"
2016-04-25 16:18:21 +00:00
2016-04-26 15:42:50 +00:00
docker pull registry.news.api.bbci.co.uk/mbt-build
2016-04-25 16:18:21 +00:00
printf "\nBuild RPM\n\n"
2016-04-26 15:42:50 +00:00
cosmos-build --os=centos7 -s docker -i registry.news.api.bbci.co.uk/mbt-build