-
Notifications
You must be signed in to change notification settings - Fork 7
/
Dockerfile
49 lines (38 loc) · 1.1 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# --------------------------
# Build d-operators binary
# --------------------------
FROM golang:1.13.5 as builder
WORKDIR /mayadata.io/d-operators/
# copy go modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
# ensure vendoring is up-to-date by running make vendor
# in your local setup
#
# we cache the vendored dependencies before building and
# copying source so that we don't need to re-download when
# source changes don't invalidate our downloaded layer
RUN go mod download
RUN go mod tidy
RUN go mod vendor
# copy build manifests
COPY Makefile Makefile
# copy source files
COPY cmd/ cmd/
COPY common/ common/
COPY config/ config/
COPY controller/ controller/
COPY pkg/ pkg/
COPY types/ types/
# build binary
RUN make
# ---------------------------
# Use distroless as minimal base image to package the final binary
# Refer https://github.com/GoogleContainerTools/distroless
# ---------------------------
FROM gcr.io/distroless/static:nonroot
WORKDIR /
COPY config/metac.yaml /etc/config/metac/metac.yaml
COPY --from=builder /mayadata.io/d-operators/dope /usr/bin/
USER nonroot:nonroot
CMD ["/usr/bin/dope"]