From 12b4700397dbabb4f0f2accfa9debbd166c7220b Mon Sep 17 00:00:00 2001 From: Lan Tian Date: Thu, 9 Apr 2020 23:38:59 +0800 Subject: [PATCH] Fix docker build error --- .travis.yml | 17 +---------------- frontend/{Dockerfile => Dockerfile.amd64} | 5 ++--- frontend/Dockerfile.arm32v7 | 13 +++++++++++++ frontend/Dockerfile.arm64v8 | 13 +++++++++++++ frontend/Dockerfile.i386 | 13 +++++++++++++ proxy/{Dockerfile => Dockerfile.amd64} | 5 ++--- proxy/Dockerfile.arm32v7 | 13 +++++++++++++ proxy/Dockerfile.arm64v8 | 13 +++++++++++++ proxy/Dockerfile.i386 | 13 +++++++++++++ 9 files changed, 83 insertions(+), 22 deletions(-) rename frontend/{Dockerfile => Dockerfile.amd64} (79%) create mode 100644 frontend/Dockerfile.arm32v7 create mode 100644 frontend/Dockerfile.arm64v8 create mode 100644 frontend/Dockerfile.i386 rename proxy/{Dockerfile => Dockerfile.amd64} (79%) create mode 100644 proxy/Dockerfile.arm32v7 create mode 100644 proxy/Dockerfile.arm64v8 create mode 100644 proxy/Dockerfile.i386 diff --git a/.travis.yml b/.travis.yml index 059a801..de6f490 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,25 +17,10 @@ install: script: - | - # Translate to alternative arch names used in multiarch images - if [ "$IMAGE_ARCH" == "amd64" ]; then IMAGE_ARCH_ALT=amd64 ; fi - if [ "$IMAGE_ARCH" == "i386" ]; then IMAGE_ARCH_ALT=i386 ; fi - if [ "$IMAGE_ARCH" == "arm32v7" ]; then IMAGE_ARCH_ALT=armhf ; fi - if [ "$IMAGE_ARCH" == "arm64v8" ]; then IMAGE_ARCH_ALT=aarch64; fi - - # Translate to alternative arch names used in golang - if [ "$IMAGE_ARCH" == "amd64" ]; then IMAGE_ARCH_GO=amd64; fi - if [ "$IMAGE_ARCH" == "i386" ]; then IMAGE_ARCH_GO=386 ; fi - if [ "$IMAGE_ARCH" == "arm32v7" ]; then IMAGE_ARCH_GO=arm ; fi - if [ "$IMAGE_ARCH" == "arm64v8" ]; then IMAGE_ARCH_GO=arm64; fi - # Build image docker build \ -t $DOCKER_USERNAME/$IMAGE_NAME:$IMAGE_ARCH \ - -f $PROGRAM/Dockerfile \ - --build-arg IMAGE_ARCH=$IMAGE_ARCH \ - --build-arg IMAGE_ARCH_ALT=$IMAGE_ARCH_ALT \ - --build-arg IMAGE_ARCH_GO=$IMAGE_ARCH_GO \ + -f $PROGRAM/Dockerfile.$IMAGE_ARCH \ $PROGRAM # Tag image :{arch} and :{arch}-build{build number} diff --git a/frontend/Dockerfile b/frontend/Dockerfile.amd64 similarity index 79% rename from frontend/Dockerfile rename to frontend/Dockerfile.amd64 index b116a78..13a593f 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile.amd64 @@ -1,8 +1,7 @@ -ARG THIS_ARCH_ALT=amd64 -FROM ${THIS_ARCH}/debian:buster +FROM amd64/debian:buster LABEL Lan Tian "lantian@lantian.pub" -ENV GOOS=linux GOARCH=${THIS_ARCH_GO} +ENV GOOS=linux GOARCH=amd64 WORKDIR /root COPY . . RUN apt-get -qq update && DEBIAN_FRONTEND=noninteractive apt-get -qq install -y golang \ diff --git a/frontend/Dockerfile.arm32v7 b/frontend/Dockerfile.arm32v7 new file mode 100644 index 0000000..e9d33b5 --- /dev/null +++ b/frontend/Dockerfile.arm32v7 @@ -0,0 +1,13 @@ +FROM arm32v7/debian:buster + +LABEL Lan Tian "lantian@lantian.pub" +ENV GOOS=linux GOARCH=arm +WORKDIR /root +COPY . . +RUN apt-get -qq update && DEBIAN_FRONTEND=noninteractive apt-get -qq install -y golang \ + && cd /root && go build -o /frontend \ + && cd / && rm -rf /root/* \ + && apt-get -qq purge -y golang \ + && apt-get -qq autoremove --purge -y && apt-get clean && rm -rf /var/lib/apt/lists + +ENTRYPOINT ["/frontend"] diff --git a/frontend/Dockerfile.arm64v8 b/frontend/Dockerfile.arm64v8 new file mode 100644 index 0000000..b3195d9 --- /dev/null +++ b/frontend/Dockerfile.arm64v8 @@ -0,0 +1,13 @@ +FROM arm64v8/debian:buster + +LABEL Lan Tian "lantian@lantian.pub" +ENV GOOS=linux GOARCH=arm64 +WORKDIR /root +COPY . . +RUN apt-get -qq update && DEBIAN_FRONTEND=noninteractive apt-get -qq install -y golang \ + && cd /root && go build -o /frontend \ + && cd / && rm -rf /root/* \ + && apt-get -qq purge -y golang \ + && apt-get -qq autoremove --purge -y && apt-get clean && rm -rf /var/lib/apt/lists + +ENTRYPOINT ["/frontend"] diff --git a/frontend/Dockerfile.i386 b/frontend/Dockerfile.i386 new file mode 100644 index 0000000..dd5fcae --- /dev/null +++ b/frontend/Dockerfile.i386 @@ -0,0 +1,13 @@ +FROM i386/debian:buster + +LABEL Lan Tian "lantian@lantian.pub" +ENV GOOS=linux GOARCH=386 +WORKDIR /root +COPY . . +RUN apt-get -qq update && DEBIAN_FRONTEND=noninteractive apt-get -qq install -y golang \ + && cd /root && go build -o /frontend \ + && cd / && rm -rf /root/* \ + && apt-get -qq purge -y golang \ + && apt-get -qq autoremove --purge -y && apt-get clean && rm -rf /var/lib/apt/lists + +ENTRYPOINT ["/frontend"] diff --git a/proxy/Dockerfile b/proxy/Dockerfile.amd64 similarity index 79% rename from proxy/Dockerfile rename to proxy/Dockerfile.amd64 index 7431961..bc2c20a 100644 --- a/proxy/Dockerfile +++ b/proxy/Dockerfile.amd64 @@ -1,8 +1,7 @@ -ARG THIS_ARCH_ALT=amd64 -FROM ${THIS_ARCH}/debian:buster +FROM amd64/debian:buster LABEL Lan Tian "lantian@lantian.pub" -ENV GOOS=linux GOARCH=${THIS_ARCH_GO} +ENV GOOS=linux GOARCH=amd64 WORKDIR /root COPY . . RUN apt-get -qq update && DEBIAN_FRONTEND=noninteractive apt-get -qq install -y golang traceroute \ diff --git a/proxy/Dockerfile.arm32v7 b/proxy/Dockerfile.arm32v7 new file mode 100644 index 0000000..8db0194 --- /dev/null +++ b/proxy/Dockerfile.arm32v7 @@ -0,0 +1,13 @@ +FROM arm32v7/debian:buster + +LABEL Lan Tian "lantian@lantian.pub" +ENV GOOS=linux GOARCH=arm +WORKDIR /root +COPY . . +RUN apt-get -qq update && DEBIAN_FRONTEND=noninteractive apt-get -qq install -y golang traceroute \ + && cd /root && go build -o /proxy \ + && cd / && rm -rf /root/* \ + && apt-get -qq purge -y golang \ + && apt-get -qq autoremove --purge -y && apt-get clean && rm -rf /var/lib/apt/lists + +ENTRYPOINT ["/proxy"] diff --git a/proxy/Dockerfile.arm64v8 b/proxy/Dockerfile.arm64v8 new file mode 100644 index 0000000..d6707c3 --- /dev/null +++ b/proxy/Dockerfile.arm64v8 @@ -0,0 +1,13 @@ +FROM arm64v8/debian:buster + +LABEL Lan Tian "lantian@lantian.pub" +ENV GOOS=linux GOARCH=arm64 +WORKDIR /root +COPY . . +RUN apt-get -qq update && DEBIAN_FRONTEND=noninteractive apt-get -qq install -y golang traceroute \ + && cd /root && go build -o /proxy \ + && cd / && rm -rf /root/* \ + && apt-get -qq purge -y golang \ + && apt-get -qq autoremove --purge -y && apt-get clean && rm -rf /var/lib/apt/lists + +ENTRYPOINT ["/proxy"] diff --git a/proxy/Dockerfile.i386 b/proxy/Dockerfile.i386 new file mode 100644 index 0000000..15d0e95 --- /dev/null +++ b/proxy/Dockerfile.i386 @@ -0,0 +1,13 @@ +FROM i386/debian:buster + +LABEL Lan Tian "lantian@lantian.pub" +ENV GOOS=linux GOARCH=386 +WORKDIR /root +COPY . . +RUN apt-get -qq update && DEBIAN_FRONTEND=noninteractive apt-get -qq install -y golang traceroute \ + && cd /root && go build -o /proxy \ + && cd / && rm -rf /root/* \ + && apt-get -qq purge -y golang \ + && apt-get -qq autoremove --purge -y && apt-get clean && rm -rf /var/lib/apt/lists + +ENTRYPOINT ["/proxy"]