2024-05-08 14:21:49 +08:00
|
|
|
FROM golang:alpine as build
|
|
|
|
|
2024-05-08 14:33:40 +08:00
|
|
|
RUN apk add upx
|
|
|
|
|
2024-05-08 14:21:49 +08:00
|
|
|
WORKDIR /build
|
|
|
|
|
|
|
|
COPY . .
|
|
|
|
|
|
|
|
ENV GO111MODULE=on
|
|
|
|
ENV GOPROXY=https://goproxy.cn,direct
|
|
|
|
|
2024-05-08 14:33:40 +08:00
|
|
|
RUN go mod download && go build -o app && upx -9 app
|
2024-05-08 14:21:49 +08:00
|
|
|
|
|
|
|
RUN ls -lh && chmod +x ./app
|
|
|
|
|
|
|
|
FROM alpine
|
|
|
|
|
|
|
|
COPY --from=build /build/app /bin
|
2024-05-08 14:44:10 +08:00
|
|
|
COPY --from=build /build/template/* /template/
|
2024-05-08 14:21:49 +08:00
|
|
|
|
|
|
|
RUN ls -al /bin/ | grep 'app'
|
|
|
|
|
|
|
|
ENTRYPOINT ["/bin/app"]
|