forked from G-Research/geras
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
32 lines (29 loc) · 1.12 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# build stage
FROM golang:alpine AS build-env
ADD . /src
WORKDIR /src
RUN apk add git
ARG GRPC_HEALTH_PROBE_VERSION=v0.3.0
RUN go get github.com/grpc-ecosystem/grpc-health-probe@${GRPC_HEALTH_PROBE_VERSION}
# Normally built on CircleCI, you can get a dev image with version info with:
# docker build --build-arg GIT_REVISION="$(git rev-parse HEAD)" \
# --build-arg GIT_BRANCH="$(git rev-parse --abbrev-ref HEAD)" .
ARG GERAS_VERSION="development"
ARG BUILD_USER="docker"
ARG GIT_REVISION="unknown"
ARG GIT_BRANCH="unknown"
ENV GO111MODULE=on
RUN go install -mod=vendor -ldflags '-extldflags "-static" \
-X github.com/prometheus/common/version.Version='"${GERAS_VERSION}"' \
-X github.com/prometheus/common/version.Revision='"${GIT_REVISION}"' \
-X github.com/prometheus/common/version.Branch='"${GIT_BRANCH}"' \
-X github.com/prometheus/common/version.BuildUser='"${BUILD_USER}"' \
-X github.com/prometheus/common/version.BuildDate='"$(date +%Y%m%d-%H:%M:%S)" \
./cmd/geras
# final stage
FROM alpine
WORKDIR /bin
COPY --from=build-env /go/bin/geras .
COPY --from=build-env /go/bin/grpc-health-probe .
USER 1000
ENTRYPOINT ["./geras"]