# syntax = docker/dockerfile:experimental # 编译 FROM golang:1.16-alpine3.13 COPY . /build/ WORKDIR /build RUN GOPROXY=https://goproxy.cn CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-X recook/configs.environment=debug" -tags=jsoniter -v -o ./bin/server ./main.go # 运行阶段 基础镜像加上时区 FROM harbor.oa00.com/library/alpine # 设置源 # 从编译阶段的中拷贝编译结果到当前镜像中 COPY --from=0 /build/bin/server /www/wwwroot/recook_v2 COPY ./credentials /www/wwwroot/credentials COPY ./qr_resource /www/wwwroot/qr_resource # 拷贝配置文件 WORKDIR /www/wwwroot ENTRYPOINT ["/www/wwwroot/recook_v2"]