forked from blind-oracle/cortex-tenant
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
38 lines (25 loc) · 812 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
31
32
33
34
35
36
37
38
FROM golang:stretch as builder
ENV GO111MODULE=on \
CGO_ENABLED=0
WORKDIR /build
# Cache modules
COPY go.mod .
COPY go.sum .
RUN go mod download
COPY . .
RUN make build
WORKDIR /dist
RUN cp /build/cortex-tenant ./cortex-tenant
RUN ldd cortex-tenant | tr -s '[:blank:]' '\n' | grep '^/' | \
xargs -I % sh -c 'mkdir -p $(dirname ./%); cp % ./%;'
RUN mkdir -p lib64 && cp /lib64/ld-linux-x86-64.so.2 lib64/
RUN mkdir /data && cp /build/deploy/cortex-tenant.yml /data/cortex-tenant.yml
FROM scratch
ENV CONFIG_FILE /data/cortex-tenant.yml
COPY --chown=65534:0 --from=builder /dist /
COPY --chown=65534:0 --from=builder /data /data
USER 65534
WORKDIR /data
COPY --from=alpine:latest /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
ENTRYPOINT ["/cortex-tenant"]
CMD ["-config", "$CONFIG_PATH"]