This commit is contained in:
parent
859ebb3206
commit
7a66b2b63b
@ -23,6 +23,7 @@ steps:
|
||||
environment:
|
||||
GOPROXY: "https://goproxy.cn,direct" # 懂的都懂
|
||||
commands:
|
||||
- echo "start build app"
|
||||
- CGO_ENABLED=0 go build -o cli -ldflags="-w -s"
|
||||
when:
|
||||
branch:
|
||||
|
11
Dockerfile
11
Dockerfile
@ -1,8 +1,9 @@
|
||||
# syntax=docker/dockerfile:1.2
|
||||
# FROM golang:1.22-alpine as base
|
||||
# FROM golang as builder
|
||||
# ENV GO111MODULE on
|
||||
# ENV GOPROXY=https://goproxy.io
|
||||
# WORKDIR /src
|
||||
# RUN groupadd -r appuser && useradd --no-log-init -r -g appuser appuser
|
||||
# 通过提前运行go mod download可以使用cache编译,避免每次编译都下载,加快编译速度
|
||||
# RUN --mount=type=cache,target=/go/pkg/mod/ \
|
||||
# --mount=type=bind,source=/go.sum,target=/go.sum \
|
||||
@ -10,14 +11,18 @@
|
||||
# go mod download -x
|
||||
# COPY . .
|
||||
# RUN --mount=type=cache,target=/go/pkg/mod/ \
|
||||
# GOOS=linux CGO_ENABLED=0 go build -o /bin/cli -ldflags="-w -s"
|
||||
# GOOS=linux CGO_ENABLED=0 GOARCH=amd64 go build -o /bin/cli -ldflags="-w -s"
|
||||
|
||||
|
||||
# 生成alpine部署容器
|
||||
FROM scratch as client
|
||||
LABEL MAINTAINER='LIU Peng<liupeng@daymele.com>'
|
||||
WORKDIR /
|
||||
# COPY --from=build-client /bin/cli /cli
|
||||
# COPY --from=builder /bin/cli /cli
|
||||
# COPY --from=builder /etc/passwd /etc/passwd
|
||||
# COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
|
||||
# COPY --from=builder /bin/appmain /bin/appmain
|
||||
# USER appuser
|
||||
COPY ./cli /cli
|
||||
# 健康检测 scratch 镜像没有其它shell指令,所以无法进行健康检测
|
||||
# ADD ./hc.sh /root/healthcheck.sh
|
||||
|
Loading…
Reference in New Issue
Block a user