阿里云codeup构建镜像的dockefile文件

2021-12-27  本文已影响0人  bug去无踪

默认使用goproxy.cn

export GOPROXY=https://goproxy.cn

cat << EOF > Dockerfile

Building stage

FROM golang:1.15-alpine3.12 AS builder

COPY . /build
WORKDIR /build

ENV GO111MODULE on

RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o SERVICE_NAME -mod=vendor cmd/main.go

Production stage

FROM alpine:3.12 AS final

WORKDIR /app

COPY --from=builder /build/SERVICE_NAME /usr/bin
COPY --from=builder /build/config/appconfig.json /etc/SERVICE_NAME/

CMD SERVICE_NAME --app.config.path=/etc/SERVICE_NAME/appconfig.json
EOF

补充:
配置codeup 的访问仓库:在C:\Users\xxxx 目录下添加 _netrc 文件,内容如下:machine codeup.aliyun.com login xxx password xxx(xxx为个人的codeup拉取代码设置的账号密码)

上一篇 下一篇

猜你喜欢

热点阅读