美文网首页
阿里云codeup构建镜像的dockefile文件

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

作者: bug去无踪 | 来源:发表于2021-12-27 18:44 被阅读0次

默认使用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拉取代码设置的账号密码)

相关文章

网友评论

      本文标题:阿里云codeup构建镜像的dockefile文件

      本文链接:https://www.haomeiwen.com/subject/fywyqrtx.html