build: add optional compact Windows release packaging
This commit is contained in:
1 parent
ee7844cb40
commit
789342ab4f
6 files changed
+114
-6
No files matched your search
@@ -40,6 +40,27 @@ RUN GOBIN=/usr/local/bin go install "google.golang.org/protobuf/cmd/protoc-gen-g
|
||||
# the toolchain image rather than a host prerequisite.
|
||||
RUN GOBIN=/usr/local/bin go install "github.com/tc-hib/go-winres@v${GO_WINRES_VERSION}"
|
||||
|
||||
# Optional compact release packaging. Keep this after the Go tooling so adding
|
||||
# the packer does not invalidate those expensive cached build layers.
|
||||
ARG UPX_VERSION=5.2.1
|
||||
ARG UPX_AMD64_SHA256=402162aad30af47e60dbd767fb2e64ca394ace9727ba1f40283641f1d1b91657
|
||||
ARG UPX_ARM64_SHA256=a72d112c5970a904a31da0b9c84f919bc16b9a311787c12245508544a78c7d36
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends xz-utils \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& case "${TARGETARCH}" in \
|
||||
amd64) upx_sha="${UPX_AMD64_SHA256}" ;; \
|
||||
arm64) upx_sha="${UPX_ARM64_SHA256}" ;; \
|
||||
*) echo "unsupported UPX host architecture: ${TARGETARCH}" >&2; exit 1 ;; \
|
||||
esac \
|
||||
&& curl --fail --location --retry 3 --connect-timeout 15 --max-time 180 \
|
||||
"https://github.com/upx/upx/releases/download/v${UPX_VERSION}/upx-${UPX_VERSION}-${TARGETARCH}_linux.tar.xz" \
|
||||
-o /tmp/upx.tar.xz \
|
||||
&& echo "${upx_sha} /tmp/upx.tar.xz" | sha256sum -c - \
|
||||
&& tar -xJf /tmp/upx.tar.xz -C /usr/local/bin --strip-components=1 \
|
||||
"upx-${UPX_VERSION}-${TARGETARCH}_linux/upx" \
|
||||
&& rm /tmp/upx.tar.xz
|
||||
|
||||
RUN mkdir -p /cache/go-build /cache/go/pkg/mod /cache/xdg /workspace \
|
||||
&& chown -R 1001:1001 /cache /workspace
|
||||
|
||||
|
||||
Reference in new issue
Block a user