Skip to content

devops-works/docker-golang-upx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 

Repository files navigation

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.23 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

About

Golang builder image with UPX included

Resources

Stars

Watchers

Forks

Packages

No packages published