1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| FROM golang:1.16-alpine3.13 COPY . /build/ WORKDIR /build RUN GOPROXY=https://goproxy.cn GOSUMDB=off CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -ldflags '-w -s' -o server
FROM alpine:3.13
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories && \
apk add --no-cache tzdata && echo "Asia/Shanghai" > /etc/timezone && ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
COPY --from=0 /build/server /
COPY --from=0 /build/config/app.ini /data/config/app.ini COPY --from=0 /build/config/app.test.ini /data/config/app.test.ini WORKDIR /data ENTRYPOINT ["/server"]
|