Skip to content

Commit

Permalink
Merge pull request #875 from hairyhenderson/revert-upx-to-3.94
Browse files Browse the repository at this point in the history
Use upx 3.94 for compressing
  • Loading branch information
Dave Henderson authored and GitHub committed Jun 13, 2020
2 parents 7c09fed + 04cd22e commit bc9fdd0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
12 changes: 6 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
14 changes: 13 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 $< > $@
Expand Down

0 comments on commit bc9fdd0

Please sign in to comment.