forked from AmitKumarDas/metac
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
46 lines (35 loc) · 1.03 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
# Build metac binary
FROM golang:1.12.5 as builder
WORKDIR /go/src/openebs.io/metac/
# 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 GO111MODULE=on go mod download
RUN GO111MODULE=on go mod vendor
# copy build manifests
COPY Makefile Makefile
# copy source files
COPY *.go ./
COPY apis/ apis/
COPY hack/ hack/
COPY controller/ controller/
COPY dynamic/ dynamic/
COPY hooks/ hooks/
COPY server/ server/
COPY third_party/ third_party/
# build metacontroller binary
RUN make
# Use debian as minimal base image to package the final binary
FROM debian:stretch-slim
WORKDIR /
RUN apt-get update && \
apt-get install --no-install-recommends -y ca-certificates && \
rm -rf /var/lib/apt/lists/*
COPY --from=builder /go/src/openebs.io/metac/metac /usr/bin/
CMD ["/usr/bin/metac"]