-
Notifications
You must be signed in to change notification settings - Fork 16
/
Dockerfile.debug
71 lines (55 loc) · 1.54 KB
/
Dockerfile.debug
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# Tester image
FROM golang:1.13.5 as tester
WORKDIR /go/src/openebs.io/metac/
# copy go modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
# copy build manifests
COPY Makefile Makefile
# 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 make vendor
# copy build manifests
COPY . .
RUN make unit-test
RUN make integration-test
# Build metac binary
FROM golang:1.13.5 as builder
WORKDIR /go/src/openebs.io/metac/
# copy go modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
# copy build manifests
COPY Makefile Makefile
# 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 make vendor
# copy source files
COPY *.go ./
COPY apis/ apis/
COPY client/ client/
COPY config/ config/
COPY hack/ hack/
COPY controller/ controller/
COPY dynamic/ dynamic/
COPY hooks/ hooks/
COPY server/ server/
COPY start/ start/
COPY third_party/ third_party/
# build metacontroller binary
RUN make bins
# Use a distroless image
# Sort the instructions to be more effective for caching
FROM gcr.io/distroless/base-debian10:debug-nonroot
WORKDIR /
USER nonroot:nonroot
CMD ["/usr/bin/metac"]
COPY --from=builder --chown=nonroot /go/src/openebs.io/metac/metac /usr/bin/