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..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,19 +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 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 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 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 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