Browse Source

Merge pull request #51 from kevwan/upx

build: remove go env GO111MODULUES, add upx to reduce image size
topic
yedf2 5 years ago
committed by GitHub
parent
commit
9308c31c8a
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      helper/Dockerfile-release

2
helper/Dockerfile-release

@ -1,10 +1,10 @@
FROM golang:1.16.6-alpine3.14 as builder
WORKDIR /app/dtm
RUN go env -w GO111MODULE=on
# RUN go env -w GOPROXY=https://mirrors.aliyun.com/goproxy/,direct
EXPOSE 8080
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" app/main.go
RUN apk add upx && upx main
FROM alpine:3.14 as runner
COPY --from=builder /app/dtm/main /app/dtm/

Loading…
Cancel
Save