Skip to content

Commit

Permalink
Merge pull request #33 from seatgeek/docker-hub-versioning
Browse files Browse the repository at this point in the history
Go 1.14 and version awarness
  • Loading branch information
burdandrei committed Jul 28, 2020
2 parents 74d3348 + 80864a5 commit bf5dade
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
7 changes: 5 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# Build layer
FROM golang:1.13 AS builder
FROM golang:1.14 AS builder
WORKDIR /go/src/github.com/seatgeek/resec
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o build/resec .
ARG RESEC_VERSION
ENV RESEC_VERSION ${RESEC_VERSION:-local-dev}
RUN echo $RESEC_VERSION
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-X 'main.Version=${RESEC_VERSION}'" -a -installsuffix cgo -o build/resec .

# Run layer
FROM alpine:latest
Expand Down
8 changes: 8 additions & 0 deletions hooks/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

if [ $DOCKER_TAG == "latest" ]
then
docker build . --build-arg RESEC_VERSION=${SOURCE_BRANCH} -t ${IMAGE_NAME}
else
docker build . --build-arg RESEC_VERSION=${DOCKER_TAG} -t ${IMAGE_NAME}
fi
4 changes: 3 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func main() {
},
cli.StringFlag{
Name: "consul-lock-key",
Usage: "KV lock location, should be overriden if multiple instances running in the same consul DC",
Usage: "KV lock location, should be overridden if multiple instances running in the same consul DC",
Value: "resec/.lock",
EnvVar: "CONSUL_LOCK_KEY",
},
Expand Down Expand Up @@ -139,6 +139,8 @@ func main() {
default:
log.Fatalf("Invalid log format '%s', please use on of [text, json, gelf]", c.String("log-format"))
}

log.Infof("Starting ReSeC %s", Version)
return nil
}
app.Action = func(c *cli.Context) error {
Expand Down

0 comments on commit bf5dade

Please sign in to comment.