diff --git a/Dockerfile b/Dockerfile index 5bd053e4..bcc8456a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # syntax=docker/dockerfile:1.1.5-experimental -FROM --platform=linux/amd64 hairyhenderson/upx:3.96 AS upx +FROM --platform=linux/amd64 hairyhenderson/upx:3.94 AS upx FROM --platform=linux/amd64 golang:1.14.4-alpine3.12 AS build @@ -32,8 +32,8 @@ ARG TARGETARCH ARG TARGETVARIANT RUN apk add --no-cache \ - make \ - libgcc libstdc++ ucl + make \ + libgcc libstdc++ ucl ENV GOOS=$TARGETOS GOARCH=$TARGETARCH WORKDIR /go/src/github.com/hairyhenderson/gomplate @@ -54,7 +54,7 @@ ARG TARGETARCH ARG TARGETVARIANT LABEL org.opencontainers.image.revision=$VCS_REF \ - org.opencontainers.image.source="https://github.com/hairyhenderson/gomplate" + org.opencontainers.image.source="https://github.com/hairyhenderson/gomplate" COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt COPY --from=build /bin/gomplate_${TARGETOS}-${TARGETARCH}${TARGETVARIANT} /gomplate @@ -69,7 +69,7 @@ ARG TARGETARCH ARG TARGETVARIANT LABEL org.opencontainers.image.revision=$VCS_REF \ - org.opencontainers.image.source="https://github.com/hairyhenderson/gomplate" + org.opencontainers.image.source="https://github.com/hairyhenderson/gomplate" COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt COPY --from=compress /bin/gomplate_${TARGETOS}-${TARGETARCH}${TARGETVARIANT}-slim /bin/gomplate @@ -84,7 +84,7 @@ ARG TARGETARCH ARG TARGETVARIANT LABEL org.opencontainers.image.revision=$VCS_REF \ - org.opencontainers.image.source="https://github.com/hairyhenderson/gomplate" + org.opencontainers.image.source="https://github.com/hairyhenderson/gomplate" COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt COPY --from=compress /bin/gomplate_${TARGETOS}-${TARGETARCH}${TARGETVARIANT}-slim /gomplate diff --git a/Makefile b/Makefile index a3e16abc..ccebeb5f 100644 --- a/Makefile +++ b/Makefile @@ -49,11 +49,23 @@ build-x: $(patsubst %,$(PREFIX)/bin/$(PKG_NAME)_%,$(platforms)) compress-all: $(patsubst %,$(PREFIX)/bin/$(PKG_NAME)_%,$(compressed-platforms)) +UPX_VERSION := $(shell upx --version | head -n1 | cut -f2 -d\ ) +UPX_REQUIRED_VERSION := 3.94 + + +ifeq ($(UPX_REQUIRED_VERSION),$(UPX_VERSION)) $(PREFIX)/bin/$(PKG_NAME)_%-slim: $(PREFIX)/bin/$(PKG_NAME)_% upx --lzma $< -o $@ - $(PREFIX)/bin/$(PKG_NAME)_windows-%-slim.exe: $(PREFIX)/bin/$(PKG_NAME)_windows-%.exe upx --lzma $< -o $@ +else +$(PREFIX)/bin/$(PKG_NAME)_%-slim: + $(error Wrong upx version - need $(UPX_REQUIRED_VERSION)) + +$(PREFIX)/bin/$(PKG_NAME)_windows-%-slim.exe: + $(error Wrong upx version - need $(UPX_REQUIRED_VERSION)) +endif + $(PREFIX)/bin/$(PKG_NAME)_%_checksum_sha256.txt: $(PREFIX)/bin/$(PKG_NAME)_% @sha256sum $< > $@