Skip to content

Commit bf5dade

Browse files
authored
Merge pull request #33 from seatgeek/docker-hub-versioning
Go 1.14 and version awarness
2 parents 74d3348 + 80864a5 commit bf5dade

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

Dockerfile

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
# Build layer
2-
FROM golang:1.13 AS builder
2+
FROM golang:1.14 AS builder
33
WORKDIR /go/src/github.com/seatgeek/resec
44
COPY . .
5-
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o build/resec .
5+
ARG RESEC_VERSION
6+
ENV RESEC_VERSION ${RESEC_VERSION:-local-dev}
7+
RUN echo $RESEC_VERSION
8+
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-X 'main.Version=${RESEC_VERSION}'" -a -installsuffix cgo -o build/resec .
69

710
# Run layer
811
FROM alpine:latest

hooks/build

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
3+
if [ $DOCKER_TAG == "latest" ]
4+
then
5+
docker build . --build-arg RESEC_VERSION=${SOURCE_BRANCH} -t ${IMAGE_NAME}
6+
else
7+
docker build . --build-arg RESEC_VERSION=${DOCKER_TAG} -t ${IMAGE_NAME}
8+
fi

main.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func main() {
3434
},
3535
cli.StringFlag{
3636
Name: "consul-lock-key",
37-
Usage: "KV lock location, should be overriden if multiple instances running in the same consul DC",
37+
Usage: "KV lock location, should be overridden if multiple instances running in the same consul DC",
3838
Value: "resec/.lock",
3939
EnvVar: "CONSUL_LOCK_KEY",
4040
},
@@ -139,6 +139,8 @@ func main() {
139139
default:
140140
log.Fatalf("Invalid log format '%s', please use on of [text, json, gelf]", c.String("log-format"))
141141
}
142+
143+
log.Infof("Starting ReSeC %s", Version)
142144
return nil
143145
}
144146
app.Action = func(c *cli.Context) error {

0 commit comments

Comments
 (0)