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
2016-04-25 17:18:21 +01:00

28 lines
853 B
Bash

printf "\nPull Golang Container 1.6.2\n\n"
CONTAINER_WS=/gopath/src/github.com/integralsit/go-app/src
docker pull golang:1.6.2
printf "\nInstall Dependencies\n\n"
docker run --rm=true -v $WORKSPACE/src:$CONTAINER_WS -e "GOPATH=/gopath" -w $CONTAINER_WS golang:1.6.2 \
sh -c 'go get github.com/Masterminds/glide && /gopath/bin/glide install'
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 \
sh -c 'CGO_ENABLED=0 go build -a --installsuffix cgo --ldflags=\"-s\" -o go-app-binary'
printf "\nMove Binary to SOURCES\n\n"
mv src/go-app-binary SOURCES
printf "\nPull Custom Build Container\n\n"
docker pull registry.bbc.co.uk/custom-build
printf "\nBuild RPM\n\n"
custom-build --os=centos7 -s docker -i registry.bbc.co.uk/custom-build