Skip to content

Commit

Permalink
Add a Dockerfile and make changes to the build script to build static…
Browse files Browse the repository at this point in the history
… binary for cloudprober.

ORIGINAL_AUTHOR=Manu Garg <[email protected]>
PiperOrigin-RevId: 160863376
  • Loading branch information
manugarg committed Jul 4, 2017
1 parent 8dc4c68 commit 7d1a7e3
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
10 changes: 9 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,12 @@ go_import_path: github.com/google/cloudprober

install: /bin/true

script: GOBIN=$GOPATH/bin tools/build.sh
script:
- GOBIN=$GOPATH/bin tools/build.sh

services:
- docker

after_success:
- cp /etc/ssl/certs/ca-certificates.crt .
- test -n "$DOCKER_IMAGE" && docker build -t ${DOCKER_IMAGE}:latest . && docker login -u ${DOCKER_USER} -p ${DOCKER_PASS} && docker push ${DOCKER_IMAGE}
10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This Dockerfile expects "cloudprober" binary and ca-certificates to exist
# in the working directory.
#
# Docker image built using this can executed in the following manner:
# docker run --net host -v $PWD/cloudprober.cfg:/etc/cloudprober.cfg \
# -v /tmp:/tmp cloudprober/cloudprober
FROM busybox
ADD cloudprober /cloudprober
COPY ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
CMD ["/cloudprober"]
4 changes: 2 additions & 2 deletions tools/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,6 @@ echo "======================================================================"
go test ./...

# Install cloudprober
echo "Installing cloudprober binary.."
echo "Build static cloudprober binary.."
echo "======================================================================"
go install cmd/cloudprober.go
CGO_ENABLED=0 go build -ldflags '-extldflags "-static"' ./cmd/cloudprober.go

0 comments on commit 7d1a7e3

Please sign in to comment.