Skip to content

Commit

Permalink
add docker build hook
Browse files Browse the repository at this point in the history
  • Loading branch information
blacktop committed Aug 27, 2018
1 parent db9ed3c commit d2e7f56
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ RUN apk --update add --no-cache -t .build-deps \
&& export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig" \
&& go version \
&& dep ensure \
&& CGO_ENABLED=1 go build -ldflags "-s -w -X main.Version=$(cat VERSION) -X main.BuildTime=$(date -u +%Y%m%d)" -o /bin/scan \
&& CGO_ENABLED=1 go build -ldflags "-s -w -X main.Version=v$(cat VERSION) -X main.BuildTime=$(date -u +%Y%m%d)" -o /bin/scan \
&& rm -rf /go /usr/local/go /usr/lib/go /tmp/* \
&& apk del --purge .build-deps

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.1.0
0.1.0
10 changes: 10 additions & 0 deletions hooks/post_push
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

set -e

VERSION=$(cat VERSION)

echo "===> Tagging $IMAGE_NAME as $DOCKER_REPO:$VERSION"
docker tag $IMAGE_NAME $DOCKER_REPO:$VERSION
echo "===> Pushing $DOCKER_REPO:$VERSION"
docker push $DOCKER_REPO:$VERSION

0 comments on commit d2e7f56

Please sign in to comment.