You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
459 B
Docker

FROM golang:1.18 as builder
WORKDIR /builder
COPY . .
RUN go mod download && go build -o app && upx -9 app
RUN ls -lh && chmod +x ./app
# 指定创建的基础镜像
FROM alpine as runner
# 替换阿里云的源
RUN echo "http://mirrors.aliyun.com/alpine/latest-stable/main/" > /etc/apk/repositories
RUN echo "http://mirrors.aliyun.com/alpine/latest-stable/community/" >> /etc/apk/repositories
WORKDIR /app
COPY --from=builder /builder/app ./app
CMD ./app