Skip to content

Commit

Permalink
Add hooks to tag builds properly
Browse files Browse the repository at this point in the history
  • Loading branch information
teran committed May 8, 2018
1 parent d88a03e commit 4877a1a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ RUN cd /go/src/github.com/teran/relay && CGO_ENABLED=0 go build -o bin/relay .

FROM alpine

ARG VCS_REF

LABEL org.label-schema.vcs-ref=$VCS_REF \
org.label-schema.vcs-url="https://github.com/teran/relay"

RUN apk add --update --no-cache \
ca-certificates && \
rm -vf /var/cache/apk/*
Expand Down
10 changes: 10 additions & 0 deletions hooks/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

echo "Build hook running"

VSC_REF=$(git rev-parse --short HEAD)

docker build --build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \
--build-arg VCS_REF=${VSC_REF} \
-t "${DOCKER_REPO}:latest" \
-t "${DOCKER_REPO}:git${VSC_REF}" .
5 changes: 5 additions & 0 deletions hooks/post_push
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

echo "Post push hook running"

docker push $DOCKER_REPO

0 comments on commit 4877a1a

Please sign in to comment.