forked from cilium/cilium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cilium-operator-aws.Dockerfile
56 lines (50 loc) · 1.92 KB
/
cilium-operator-aws.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
50
51
52
53
54
55
56
# (first line comment needed for DOCKER_BUILDKIT use)
#
ARG BASE_IMAGE=scratch
# Cross-compile go, FROM comment must be located right before the FROM
# line for the parameter to be applied on BuildKit builds.
#
# FROM --platform=$BUILDPLATFORM
FROM docker.io/library/golang:1.15.7 as builder
ARG CILIUM_SHA=""
LABEL cilium-sha=${CILIUM_SHA}
LABEL maintainer="[email protected]"
ADD . /go/src/github.com/cilium/cilium
WORKDIR /go/src/github.com/cilium/cilium/operator
ARG NOSTRIP
ARG LOCKDEBUG
ARG RACE
# TARGETARCH is an automatic platform ARG enabled by Docker BuildKit.
#
ARG TARGETARCH
RUN make GOARCH=$TARGETARCH NOSTRIP=$NOSTRIP LOCKDEBUG=$LOCKDEBUG RACE=$RACE cilium-operator-aws
WORKDIR /go/src/github.com/cilium/cilium
RUN make GOARCH=$TARGETARCH licenses-all
FROM docker.io/library/alpine:3.13.1@sha256:08d6ca16c60fe7490c03d10dc339d9fd8ea67c6466dea8d558526b1330a85930 as certs
ARG CILIUM_SHA=""
LABEL cilium-sha=${CILIUM_SHA}
RUN apk --update add ca-certificates
FROM docker.io/library/golang:1.15.7 as gops
ARG CILIUM_SHA=""
LABEL cilium-sha=${CILIUM_SHA}
# TARGETARCH is an automatic platform ARG enabled by Docker BuildKit.
#
ARG TARGETARCH
RUN GOARCH=$TARGETARCH && [ "$GOARCH" != "arm64" ] || CC="aarch64-linux-gnu-gcc" && \
go get -d github.com/google/gops && \
cd /go/src/github.com/google/gops && \
git checkout -b v0.3.14 v0.3.14 && \
git --no-pager remote -v && \
git --no-pager log -1 && \
CGO_ENABLED=0 go install && \
strip /go/bin/gops
FROM ${BASE_IMAGE}
ARG CILIUM_SHA=""
LABEL cilium-sha=${CILIUM_SHA}
LABEL maintainer="[email protected]"
COPY --from=builder /go/src/github.com/cilium/cilium/operator/cilium-operator-aws /usr/bin/cilium-operator-aws
COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=gops /go/bin/gops /bin/gops
COPY --from=builder /go/src/github.com/cilium/cilium/LICENSE.all /LICENSE.all
WORKDIR /
CMD ["/usr/bin/cilium-operator-aws"]