加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Dockerfile 709 Bytes
一键复制 编辑 原始数据 按行查看 历史
lileding 提交于 2021-07-29 14:28 . simplify cross build (#337)
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:alpine AS builder
ARG GOPROXY
ARG GIT_REV
ARG VERSION
ARG TARGETARCH
ARG TARGETOS
COPY / /go/src/baetyl-cloud
WORKDIR /go/src/baetyl-cloud
ENV GOPROXY=${GOPROXY:-direct}
RUN --mount=type=cache,id=gomod,target=/go/pkg/mod \
go mod download -x
RUN --mount=type=cache,id=gomod,target=/go/pkg/mod \
GOARCH=${TARGETARCH} CGO_ENABLED=0 \
go build -ldflags "-s -w -X github.com/baetyl/baetyl-go/v2/utils.REVISION=${GIT_REV} -X github.com/baetyl/baetyl-go/v2/utils.VERSION=${VERSION}" .
FROM scratch
COPY /scripts/native/templates /etc/templates
COPY --from=builder /go/src/baetyl-cloud/baetyl-cloud /bin/baetyl-cloud
ENTRYPOINT ["/bin/baetyl-cloud"]
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化