From 5000ad1bbf8303123e32282f78370017efece730 Mon Sep 17 00:00:00 2001 From: Lan Tian Date: Sat, 7 Nov 2020 20:24:37 +0800 Subject: [PATCH] general: add s390x & ppc64le --- .travis.yml | 4 ++++ frontend/Dockerfile.ppc64le | 9 +++++++++ frontend/Dockerfile.s390x | 9 +++++++++ proxy/Dockerfile.ppc64le | 23 +++++++++++++++++++++++ proxy/Dockerfile.s390x | 23 +++++++++++++++++++++++ 5 files changed, 68 insertions(+) create mode 100644 frontend/Dockerfile.ppc64le create mode 100644 frontend/Dockerfile.s390x create mode 100644 proxy/Dockerfile.ppc64le create mode 100644 proxy/Dockerfile.s390x diff --git a/.travis.yml b/.travis.yml index 647d83f..1c4c117 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,10 +8,14 @@ env: - PROGRAM=frontend IMAGE_NAME=bird-lg-go IMAGE_ARCH=amd64 - PROGRAM=frontend IMAGE_NAME=bird-lg-go IMAGE_ARCH=arm32v7 - PROGRAM=frontend IMAGE_NAME=bird-lg-go IMAGE_ARCH=arm64v8 + - PROGRAM=frontend IMAGE_NAME=bird-lg-go IMAGE_ARCH=ppc64le + - PROGRAM=frontend IMAGE_NAME=bird-lg-go IMAGE_ARCH=s390x - PROGRAM=proxy IMAGE_NAME=bird-lgproxy-go IMAGE_ARCH=i386 - PROGRAM=proxy IMAGE_NAME=bird-lgproxy-go IMAGE_ARCH=amd64 - PROGRAM=proxy IMAGE_NAME=bird-lgproxy-go IMAGE_ARCH=arm32v7 - PROGRAM=proxy IMAGE_NAME=bird-lgproxy-go IMAGE_ARCH=arm64v8 + - PROGRAM=proxy IMAGE_NAME=bird-lgproxy-go IMAGE_ARCH=ppc64le + - PROGRAM=proxy IMAGE_NAME=bird-lgproxy-go IMAGE_ARCH=s390x install: - docker run --rm --privileged multiarch/qemu-user-static:register --reset diff --git a/frontend/Dockerfile.ppc64le b/frontend/Dockerfile.ppc64le new file mode 100644 index 0000000..402733e --- /dev/null +++ b/frontend/Dockerfile.ppc64le @@ -0,0 +1,9 @@ +FROM golang:buster AS step_0 +ENV CGO_ENABLED=0 GOOS=linux GOARCH=ppc64le GO111MODULE=on +WORKDIR /root +COPY . . +RUN go build -o /frontend + +FROM scratch AS step_1 +COPY --from=step_0 /frontend / +ENTRYPOINT ["/frontend"] diff --git a/frontend/Dockerfile.s390x b/frontend/Dockerfile.s390x new file mode 100644 index 0000000..b92a4e8 --- /dev/null +++ b/frontend/Dockerfile.s390x @@ -0,0 +1,9 @@ +FROM golang:buster AS step_0 +ENV CGO_ENABLED=0 GOOS=linux GOARCH=s390x GO111MODULE=on +WORKDIR /root +COPY . . +RUN go build -o /frontend + +FROM scratch AS step_1 +COPY --from=step_0 /frontend / +ENTRYPOINT ["/frontend"] diff --git a/proxy/Dockerfile.ppc64le b/proxy/Dockerfile.ppc64le new file mode 100644 index 0000000..9b5f43c --- /dev/null +++ b/proxy/Dockerfile.ppc64le @@ -0,0 +1,23 @@ +FROM golang:buster AS step_0 +ENV CGO_ENABLED=0 GOOS=linux GOARCH=ppc64le GO111MODULE=on +WORKDIR /root +COPY . . +RUN go build -o /proxy + +FROM ppc64le/debian:sid AS step_1 +ENV TARGET_ARCH=ppc64le +WORKDIR /root +RUN apt-get -qq update && DEBIAN_FRONTEND=noninteractive apt-get -qq install -y \ + build-essential musl-dev musl-tools tar wget git +RUN git clone https://github.com/sabotage-linux/kernel-headers.git +RUN wget https://sourceforge.net/projects/traceroute/files/traceroute/traceroute-2.1.0/traceroute-2.1.0.tar.gz/download \ + -O traceroute-2.1.0.tar.gz +RUN tar xvf traceroute-2.1.0.tar.gz \ + && cd traceroute-2.1.0 \ + && make -j4 CC=musl-gcc CFLAGS="-I/root/kernel-headers/${TARGET_ARCH}/include" LDFLAGS="-static" + +FROM scratch AS step_2 +ENV PATH=/ +COPY --from=step_0 /proxy / +COPY --from=step_1 /root/traceroute-2.1.0/traceroute/traceroute / +ENTRYPOINT ["/proxy"] diff --git a/proxy/Dockerfile.s390x b/proxy/Dockerfile.s390x new file mode 100644 index 0000000..8a25c0f --- /dev/null +++ b/proxy/Dockerfile.s390x @@ -0,0 +1,23 @@ +FROM golang:buster AS step_0 +ENV CGO_ENABLED=0 GOOS=linux GOARCH=s390x GO111MODULE=on +WORKDIR /root +COPY . . +RUN go build -o /proxy + +FROM s390x/debian:sid AS step_1 +ENV TARGET_ARCH=s390 +WORKDIR /root +RUN apt-get -qq update && DEBIAN_FRONTEND=noninteractive apt-get -qq install -y \ + build-essential musl-dev musl-tools tar wget git +RUN git clone https://github.com/sabotage-linux/kernel-headers.git +RUN wget https://sourceforge.net/projects/traceroute/files/traceroute/traceroute-2.1.0/traceroute-2.1.0.tar.gz/download \ + -O traceroute-2.1.0.tar.gz +RUN tar xvf traceroute-2.1.0.tar.gz \ + && cd traceroute-2.1.0 \ + && make -j4 CC=musl-gcc CFLAGS="-I/root/kernel-headers/${TARGET_ARCH}/include" LDFLAGS="-static" + +FROM scratch AS step_2 +ENV PATH=/ +COPY --from=step_0 /proxy / +COPY --from=step_1 /root/traceroute-2.1.0/traceroute/traceroute / +ENTRYPOINT ["/proxy"]