Sign inSign up

devopsworks/golang-upx

By devopsworks

•Updated 1 day ago

Golang builder image with UPX included

Image
0

10K+

devopsworks/golang-upx repository overview

⁠golang-upx

Golang builder image with UPX included

UPX⁠ strip will strip your golang binaries pretty effectively, reducing you final container size.

See Docker Hub⁠ for final images.

⁠Usage

FROM devopsworks/golang-upx:1.16 as builder

WORKDIR /src

COPY go.mod .
COPY go.sum .

RUN go mod download

RUN GOOS=linux \
  GOARCH=amd64 \
  go build \
  ...
  -o /go/bin/somebinary && \
  strip /go/bin/somebinary && \
  /usr/local/bin/upx -9 /go/bin/somebinary

FROM gcr.io/distroless/base:3c29f81d9601750a95140e4297a06765c41ad10e
COPY --from=builder /go/bin/somebinary /app/somebinary

CMD ["/app/somebinary"]

⁠Authors

devopsworks⁠

Tag summary

Content type

Image

Digest

sha256:720ed7621…

Size

302.3 MB

Last updated

1 day ago

docker pull devopsworks/golang-upx