https://github.com/devops-works/docker-golang-upx
Golang builder image with UPX included
https://github.com/devops-works/docker-golang-upx
Last synced: 2 months ago
JSON representation
Golang builder image with UPX included
- Host: GitHub
- URL: https://github.com/devops-works/docker-golang-upx
- Owner: devops-works
- Created: 2019-08-16T12:01:52.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2026-01-15T22:31:38.000Z (3 months ago)
- Last Synced: 2026-01-17T05:31:04.611Z (3 months ago)
- Language: Dockerfile
- Size: 52.7 KB
- Stars: 7
- Watchers: 4
- Forks: 6
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# golang-upx
Golang builder image with UPX included
[UPX](https://upx.github.io/) strip will strip your golang binaries
pretty effectively, reducing you final container size.
See [Docker Hub](https://hub.docker.com/r/devopsworks/golang-upx) for final images.
## Usage
```dockerfile
FROM devopsworks/golang-upx:1.24 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](https://devops.works)