-
Notifications
You must be signed in to change notification settings - Fork 5
/
Dockerfile
30 lines (25 loc) · 987 Bytes
/
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
FROM golang:1.23-alpine as build
RUN apk add --update --no-cache git coreutils
WORKDIR /go/src/github.com/grafana/influx2cortex
COPY . .
RUN GIT_COMMIT="${DRONE_COMMIT:-${GITHUB_SHA:-$(git rev-list -1 HEAD)}}"; \
COMMIT_UNIX_TIMESTAMP="$(git --no-pager show -s --format=%ct "${GIT_COMMIT}")"; \
DOCKER_TAG="$(cat .tag)"; \
GOPRIVATE="github.com/grafana/*"; \
CGO_ENABLED=0; \
go build -o /bin/influx2cortex \
--ldflags " \
-w -extldflags \
'-static' \
-X 'github.com/grafana/influx2cortex/pkg/influx.CommitUnixTimestamp=${COMMIT_UNIX_TIMESTAMP}' \
-X 'github.com/grafana/influx2cortex/pkg/influx.DockerTag=${DOCKER_TAG}'\
" \
github.com/grafana/influx2cortex/cmd/influx2cortex
FROM alpine:3.12
RUN apk add --update --no-cache ca-certificates
RUN addgroup -g 1000 app && \
adduser -u 1000 -h /app -G app -S app
WORKDIR /app
USER app
COPY --from=build /bin/influx2cortex /bin/influx2cortex
ENTRYPOINT [ "/bin/influx2cortex" ]