From 0f585e0dbb46267d31f37094881e8dcfa205bc11 Mon Sep 17 00:00:00 2001 From: Konstantin Lebedev Date: Sat, 12 Nov 2022 18:52:51 +0500 Subject: [PATCH 1/3] support linux/arm64 platform https://github.com/wangyoucao577/go-release-action/issues/100 --- .github/workflows/release.yml | 2 ++ Dockerfile | 10 +++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a4bc57d..7d25435 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -31,6 +31,7 @@ jobs: name: ${{ github.actor }}/${{ env.DOCKER_REPO_NAME }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} + platforms: linux/amd64,linux/arm64 registry: ghcr.io snapshot: false tags: "${{ env.IMAGE_TAG }}" @@ -41,6 +42,7 @@ jobs: name: ${{ github.repository }} username: ${{ github.actor }} password: ${{ secrets.DOCKERHUB_TOKEN }} + platforms: linux/amd64,linux/arm64 snapshot: false tags: "${{ env.IMAGE_TAG }}" diff --git a/Dockerfile b/Dockerfile index 565c9fc..e53902d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,14 +12,14 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update && DEBIAN_FRONTEND=noninteract && rm -rf /var/lib/apt/lists/* # install latest upx 3.96 by wget instead of `apt install upx-ucl`(only 3.95) -RUN wget --no-check-certificate --progress=dot:mega https://github.com/upx/upx/releases/download/v3.96/upx-3.96-amd64_linux.tar.xz && \ - tar -Jxf upx-3.96-amd64_linux.tar.xz && \ - mv upx-3.96-amd64_linux /usr/local/ && \ - ln -s /usr/local/upx-3.96-amd64_linux/upx /usr/local/bin/upx && \ +RUN arch=$(dpkg --print-architecture);wget --no-check-certificate --progress=dot:mega https://github.com/upx/upx/releases/download/v3.96/upx-3.96-${arch}_linux.tar.xz && \ + tar -Jxf upx-3.96-${arch}_linux.tar.xz && \ + mv upx-3.96-${arch}_linux /usr/local/ && \ + ln -s /usr/local/upx-3.96-${arch}_linux/upx /usr/local/bin/upx && \ upx --version # github-assets-uploader to provide robust github assets upload -RUN wget --no-check-certificate --progress=dot:mega https://github.com/wangyoucao577/assets-uploader/releases/download/v0.9.0/github-assets-uploader-v0.9.0-linux-amd64.tar.gz -O github-assets-uploader.tar.gz && \ +RUN arch=$(dpkg --print-architecture);wget --no-check-certificate --progress=dot:mega https://github.com/wangyoucao577/assets-uploader/releases/download/v0.9.0/github-assets-uploader-v0.9.0-linux-${arch}.tar.gz -O github-assets-uploader.tar.gz && \ tar -zxf github-assets-uploader.tar.gz && \ mv github-assets-uploader /usr/sbin/ && \ rm -f github-assets-uploader.tar.gz && \ From da175ca62454d0b4ceb89965394c5e7fa498a1fc Mon Sep 17 00:00:00 2001 From: Konstantin Lebedev Date: Sun, 13 Nov 2022 11:23:16 +0500 Subject: [PATCH 2/3] dockerfile: rm upx tar.xz --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index e53902d..1c78363 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,6 +16,7 @@ RUN arch=$(dpkg --print-architecture);wget --no-check-certificate --progress=dot tar -Jxf upx-3.96-${arch}_linux.tar.xz && \ mv upx-3.96-${arch}_linux /usr/local/ && \ ln -s /usr/local/upx-3.96-${arch}_linux/upx /usr/local/bin/upx && \ + rm upx-3.96-${arch}_linux.tar.xz && \ upx --version # github-assets-uploader to provide robust github assets upload From ecbf3db2d3c047fea18473d5a56b8890a3a37633 Mon Sep 17 00:00:00 2001 From: Konstantin Lebedev Date: Sun, 13 Nov 2022 12:48:47 +0500 Subject: [PATCH 3/3] dockerfile: upx and uploader up version --- Dockerfile | 17 +++++++++++------ setup-go.sh | 17 +++++++++-------- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1c78363..7eb3bc3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,9 @@ FROM debian:stretch-slim +ARG UPX_VER +ARG UPLOADER_VER +ENV UPX_VER=${UPX_VER:-4.0.0} +ENV UPLOADER_VER=${UPLOADER_VER:-v0.9.1} RUN DEBIAN_FRONTEND=noninteractive apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \ curl \ @@ -7,20 +11,21 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update && DEBIAN_FRONTEND=noninteract git \ build-essential \ zip \ + xz-utils \ jq \ ca-certificates \ && rm -rf /var/lib/apt/lists/* # install latest upx 3.96 by wget instead of `apt install upx-ucl`(only 3.95) -RUN arch=$(dpkg --print-architecture);wget --no-check-certificate --progress=dot:mega https://github.com/upx/upx/releases/download/v3.96/upx-3.96-${arch}_linux.tar.xz && \ - tar -Jxf upx-3.96-${arch}_linux.tar.xz && \ - mv upx-3.96-${arch}_linux /usr/local/ && \ - ln -s /usr/local/upx-3.96-${arch}_linux/upx /usr/local/bin/upx && \ - rm upx-3.96-${arch}_linux.tar.xz && \ +RUN export arch=$(dpkg --print-architecture) && wget --no-check-certificate --progress=dot:mega https://github.com/upx/upx/releases/download/v${UPX_VER}/upx-${UPX_VER}-${arch}_linux.tar.xz && \ + tar -Jxf upx-${UPX_VER}-${arch}_linux.tar.xz && \ + mv upx-${UPX_VER}-${arch}_linux /usr/local/ && \ + ln -s /usr/local/upx-${UPX_VER}-${arch}_linux/upx /usr/local/bin/upx && \ + rm upx-${UPX_VER}-${arch}_linux.tar.xz && \ upx --version # github-assets-uploader to provide robust github assets upload -RUN arch=$(dpkg --print-architecture);wget --no-check-certificate --progress=dot:mega https://github.com/wangyoucao577/assets-uploader/releases/download/v0.9.0/github-assets-uploader-v0.9.0-linux-${arch}.tar.gz -O github-assets-uploader.tar.gz && \ +RUN export arch=$(dpkg --print-architecture) && wget --no-check-certificate --progress=dot:mega https://github.com/wangyoucao577/assets-uploader/releases/download/${UPLOADER_VER}/github-assets-uploader-${UPLOADER_VER}-linux-${arch}.tar.gz -O github-assets-uploader.tar.gz && \ tar -zxf github-assets-uploader.tar.gz && \ mv github-assets-uploader /usr/sbin/ && \ rm -f github-assets-uploader.tar.gz && \ diff --git a/setup-go.sh b/setup-go.sh index aa0269b..0751fec 100755 --- a/setup-go.sh +++ b/setup-go.sh @@ -1,20 +1,21 @@ #!/bin/bash -eux -GO_LINUX_PACKAGE_URL="https://go.dev/dl/$(curl https://go.dev/VERSION?m=text).linux-amd64.tar.gz" +ARCH=$(dpkg --print-architecture) +GO_LINUX_PACKAGE_URL="https://go.dev/dl/$(curl https://go.dev/VERSION?m=text).linux-${ARCH}.tar.gz" if [[ ${INPUT_GOVERSION} == "1.19" ]]; then - GO_LINUX_PACKAGE_URL="https://go.dev/dl/go1.19.1.linux-amd64.tar.gz" + GO_LINUX_PACKAGE_URL="https://go.dev/dl/go1.19.1.linux-${ARCH}.tar.gz" elif [[ ${INPUT_GOVERSION} == "1.18" ]]; then - GO_LINUX_PACKAGE_URL="https://go.dev/dl/go1.18.6.linux-amd64.tar.gz" + GO_LINUX_PACKAGE_URL="https://go.dev/dl/go1.18.6.linux-${ARCH}.tar.gz" elif [[ ${INPUT_GOVERSION} == "1.17" ]]; then - GO_LINUX_PACKAGE_URL="https://go.dev/dl/go1.17.13.linux-amd64.tar.gz" + GO_LINUX_PACKAGE_URL="https://go.dev/dl/go1.17.13.linux-${ARCH}.tar.gz" elif [[ ${INPUT_GOVERSION} == "1.16" ]]; then - GO_LINUX_PACKAGE_URL="https://go.dev/dl/go1.16.15.linux-amd64.tar.gz" + GO_LINUX_PACKAGE_URL="https://go.dev/dl/go1.16.15.linux-${ARCH}.tar.gz" elif [[ ${INPUT_GOVERSION} == "1.15" ]]; then - GO_LINUX_PACKAGE_URL="https://go.dev/dl/go1.15.15.linux-amd64.tar.gz" + GO_LINUX_PACKAGE_URL="https://go.dev/dl/go1.15.15.linux-${ARCH}.tar.gz" elif [[ ${INPUT_GOVERSION} == "1.14" ]]; then - GO_LINUX_PACKAGE_URL="https://go.dev/dl/go1.14.15.linux-amd64.tar.gz" + GO_LINUX_PACKAGE_URL="https://go.dev/dl/go1.14.15.linux-${ARCH}.tar.gz" elif [[ ${INPUT_GOVERSION} == "1.13" ]]; then - GO_LINUX_PACKAGE_URL="https://go.dev/dl/go1.13.15.linux-amd64.tar.gz" + GO_LINUX_PACKAGE_URL="https://go.dev/dl/go1.13.15.linux-${ARCH}.tar.gz" elif [[ ${INPUT_GOVERSION} == http* ]]; then GO_LINUX_PACKAGE_URL=${INPUT_GOVERSION} fi