部署准备

This commit is contained in:
admin committed 2026-11-12 09:34:43 +08:00
1 parent ee07869839
commit c191974df7
6 files changed
+296 -10

No files matched your search

+3 -5
View File
@@ -4,19 +4,17 @@ ENV GOPRIVATE=git.vitatech.com.cn
RUN git config --global url."ssh://git@git.vitatech.com.cn:12222/".insteadOf "https://git.vitatech.com.cn/" \
&& mkdir -p -m 0700 /root/.ssh
WORKDIR /src
COPY micro_layout/go.mod micro_layout/go.sum ./micro_layout/
WORKDIR /src/micro_layout
COPY go.mod go.sum ./
RUN --mount=type=ssh,required=true \
--mount=type=secret,id=git_known_hosts,target=/root/.ssh/known_hosts,required=true \
go mod download
COPY micro_layout /src/micro_layout
RUN CGO_ENABLED=0 go build -trimpath -o /out/crontab ./cmd/crontab
COPY . .
RUN CGO_ENABLED=0 go build -mod=readonly -trimpath -o /out/crontab ./cmd/crontab
FROM alpine:3.23
RUN apk add --no-cache ca-certificates tzdata
WORKDIR /app
RUN mkdir -p logs && chown 65532:65532 logs
COPY --from=builder /out/crontab ./crontab
COPY micro_layout/configs/config.yaml ./configs/config.yaml
USER 65532:65532
ENTRYPOINT ["./crontab"]
+5 -5
View File
@@ -4,20 +4,20 @@ ENV GOPRIVATE=git.vitatech.com.cn
RUN git config --global url."ssh://git@git.vitatech.com.cn:12222/".insteadOf "https://git.vitatech.com.cn/" \
&& mkdir -p -m 0700 /root/.ssh
WORKDIR /src
COPY micro_layout/go.mod micro_layout/go.sum ./micro_layout/
WORKDIR /src/micro_layout
COPY go.mod go.sum ./
RUN --mount=type=ssh,required=true \
--mount=type=secret,id=git_known_hosts,target=/root/.ssh/known_hosts,required=true \
go mod download
COPY micro_layout /src/micro_layout
RUN CGO_ENABLED=0 go build -trimpath -o /out/srv ./cmd/srv
COPY . .
RUN CGO_ENABLED=0 go build -mod=readonly -trimpath -o /out/srv ./cmd/srv \
&& CGO_ENABLED=0 go build -mod=readonly -trimpath -o /out/grpc-health ./cmd/healthcheck
FROM alpine:3.23
RUN apk add --no-cache ca-certificates tzdata
WORKDIR /app
RUN mkdir -p logs && chown 65532:65532 logs
COPY --from=builder /out/srv ./srv
COPY micro_layout/configs/config.yaml ./configs/config.yaml
COPY --from=builder /out/grpc-health ./grpc-health
USER 65532:65532
EXPOSE 50112
ENTRYPOINT ["./srv"]