Browse Source

Merge pull request #50 from kevwan/main

build: add ldflags to reduce docker image size
pull/55/head
yedf2 4 years ago
committed by GitHub
parent
commit
e35638d1fd
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      helper/Dockerfile-release

4
helper/Dockerfile-release

@ -4,10 +4,10 @@ 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 app/main.go
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" app/main.go
FROM alpine:3.14 as runner
COPY --from=builder /app/dtm/main /app/dtm/
ENV IS_DOCKER=1
WORKDIR /app/dtm
CMD ["/app/dtm/main", "dtmsvr"]
CMD ["/app/dtm/main", "dtmsvr"]

Loading…
Cancel
Save