forked from AliyunContainerService/terway
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
35 lines (33 loc) · 2.11 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
FROM golang:1.11 as builder
WORKDIR /go/src/github.com/AliyunContainerService/terway/
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags "-X \"main.gitVer=`git rev-parse --short HEAD 2>/dev/null`\" " -o terwayd .
RUN cd plugin/terway && CGO_ENABLED=0 GOOS=linux go build -o terway .
FROM calico/go-build:v0.20 as felix-builder
RUN apk --no-cache add ip6tables tini ipset iputils iproute2 conntrack-tools file git
ENV GIT_BRANCH=v3.5.2
ENV GIT_COMMIT=1e59bb818c35b96e5de6e882fcb07510f81b50da
#ENV http_proxy=1.1.1.1:1080
#ENV https_proxy=1.1.1.1:1080
RUN mkdir -p /go/src/github.com/projectcalico/ && cd /go/src/github.com/projectcalico/ && \
git clone -b ${GIT_BRANCH} https://github.com/projectcalico/felix.git && \
cd felix && [ "`git rev-parse HEAD`" = "${GIT_COMMIT}" ]
RUN cd /go/src/github.com/projectcalico/felix && glide up --strip-vendor || glide up --strip-vendor || glide up --strip-vendor # retry 3 times
COPY policy /terway_patch
RUN cd /go/src/github.com/projectcalico/felix && git apply /terway_patch/*.patch && \
go build -v -i -o bin/calico-felix-amd64 -v -ldflags \
"-X github.com/projectcalico/felix/buildinfo.GitVersion=${GIT_BRANCH} \
-X github.com/projectcalico/felix/buildinfo.BuildDate=$(date -u +'%FT%T%z') \
-X github.com/projectcalico/felix/buildinfo.GitRevision=${GIT_COMMIT} \
-B 0x${GIT_COMMIT}" "github.com/projectcalico/felix/cmd/calico-felix" && \
( ldd bin/calico-felix-amd64 2>&1 | grep -q -e "Not a valid dynamic program" \
-e "not a dynamic executable" || \
( echo "Error: bin/calico-felix-amd64 was not statically linked"; false ) )
FROM alpine:3.8
COPY policy/policyinit.sh /bin/
RUN apk --update add curl ipset bash iproute2 ethtool bridge-utils && chmod +x /bin/policyinit.sh && rm -f /var/cache/apk/*
COPY --from=felix-builder /go/src/github.com/projectcalico/felix/bin/calico-felix-amd64 /bin/calico-felix
RUN chmod +x /bin/calico-felix
COPY --from=builder /go/src/github.com/AliyunContainerService/terway/terwayd /usr/bin/terwayd
COPY --from=builder /go/src/github.com/AliyunContainerService/terway/plugin/terway/terway /usr/bin/terway
ENTRYPOINT ["/usr/bin/terwayd"]