作者 yangfu

Dockerfile fix

正在显示 1 个修改的文件 包含 19 行增加5 行删除
FROM golang:1.13 as build
FROM golang:1.13 as builder
ENV GOPROXY https://goproxy.cn
ENV GO111MODULE on
WORKDIR /go/ability
RUN git clone http://gitlab.fjmaimaimai.com/mmm-go/gocomm.git /app/gocomm
ADD go.mod .
ADD go.sum .
WORKDIR /app/ability
COPY go.mod .
COPY go.sum .
RUN go mod download
COPY . .
RUN GOOS=linux CGO_ENABLED=0 go build -ldflags="-s -w" -installsuffix cgo -o ability main.go
CMD ["/ability"]
\ No newline at end of file
#FROM scratch
FROM alpine:latest
RUN apk add --no-cache tzdata \
&& ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& echo "Asia/Shanghai" > /etc/timezone \
&& rm -rf /var/cache/apk/* /tmp/* /var/tmp/* $HOME/.cache ## 清除缓存
WORKDIR /root/
COPY --from=builder /app/ability .
#RUN ls -l
EXPOSE 8080
CMD ["./ability"]
\ No newline at end of file
... ...