forked from yamt/midonet-kubernetes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile-amd64-linux
30 lines (25 loc) · 1.09 KB
/
Dockerfile-amd64-linux
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
ARG BUILD_WORKDIR=/go/src/github.com/midonet/midonet-kubernetes
FROM golang:1.11.0 as builder-deps
ARG BUILD_WORKDIR
LABEL maintainer "YAMAMOTO Takashi <[email protected]>"
WORKDIR ${BUILD_WORKDIR}
COPY Gopkg.toml ./Gopkg.toml
COPY Gopkg.lock ./Gopkg.lock
ENV GO111MODULE=on
RUN go mod init
RUN go mod download
RUN go get github.com/tebeka/go2xunit
FROM builder-deps as builder
LABEL maintainer "YAMAMOTO Takashi <[email protected]>"
COPY cmd ./cmd
COPY pkg ./pkg
RUN CGO_ENABLED=0 GOARCH=amd64 GOOS=linux go build -ldflags '-s -w' -o dist/amd64-linux/midonet-kube-node ./cmd/midonet-kube-node
RUN CGO_ENABLED=0 GOARCH=amd64 GOOS=linux go build -ldflags '-s -w' -o dist/amd64-linux/midonet-kube-cni ./cmd/midonet-kube-cni
RUN CGO_ENABLED=0 GOARCH=amd64 GOOS=linux go build -ldflags '-s -w' -o dist/amd64-linux/midonet-kube-controllers ./cmd/midonet-kube-controllers
FROM scratch
LABEL maintainer "YAMAMOTO Takashi <[email protected]>"
ARG BUILD_WORKDIR
ARG BINARY
WORKDIR /root/
COPY --from=builder ${BUILD_WORKDIR}/dist/amd64-linux/midonet-kube-controllers .
CMD ["./midonet-kube-controllers"]