-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #147 from m-lab/commit-hash
Add version to the build and convert travis to best practices
- Loading branch information
Showing
2 changed files
with
25 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,21 @@ | ||
FROM golang:alpine | ||
FROM golang:1.12 as builder | ||
|
||
RUN apk update && apk add bash git | ||
ENV CGO_ENABLED 0 | ||
|
||
WORKDIR /go/src/github.com/m-lab/etl-gardener | ||
COPY . . | ||
|
||
# List all of the go imports, excluding any in this repo, and run go get to import them. | ||
RUN go get -u -v $(go list -f '{{join .Imports "\n"}}{{"\n"}}{{join .TestImports "\n"}}' ./... | sort | uniq | grep -v etl-gardener) | ||
# Get the requirements and put the produced binaries in /go/bin | ||
RUN go get -v -t ./... | ||
RUN go install \ | ||
-v \ | ||
-ldflags "-X github.com/m-lab/go/prometheusx.GitShortCommit=$(git log -1 --format=%h)" \ | ||
./... | ||
|
||
# Install all go executables. | ||
RUN go install -v ./... | ||
FROM alpine | ||
COPY --from=builder /go/bin/gardener /bin/gardener | ||
|
||
EXPOSE 9090 8080 | ||
|
||
CMD gardener | ||
WORKDIR / | ||
ENTRYPOINT [ "/bin/gardener" ] |