goshorly/Dockerfile

18 lines
439 B
Text
Raw Normal View History

2021-12-07 18:10:53 +00:00
FROM golang:alpine as builder
2021-12-07 14:49:58 +00:00
2021-12-07 17:09:14 +00:00
RUN apk add --no-cache gcc libgo
2021-12-07 14:49:58 +00:00
2021-12-07 17:09:14 +00:00
WORKDIR /go/src/git.ucode.space/goshorly
2021-12-07 15:15:19 +00:00
COPY . .
2021-12-07 14:49:58 +00:00
2021-12-07 15:15:19 +00:00
RUN go get -d -v ./...
2021-12-07 18:10:53 +00:00
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app .
2021-12-07 17:09:14 +00:00
2021-12-07 18:17:12 +00:00
FROM gruebel/upx:latest as upx
COPY --from=builder /go/src/git.ucode.space/goshorly/app /app.org
RUN upx --best --lzma -o /app /app.org
2021-12-07 18:10:53 +00:00
FROM scratch as production
WORKDIR /goshorly
2021-12-07 18:17:12 +00:00
copy --from=upx /app /goshorly/app
2021-12-07 18:10:53 +00:00
CMD ["./app"]