fix Deployment

This commit is contained in:
2025-07-28 02:07:53 +08:00
parent 357639462a
commit 642ca4f859
2 changed files with 33 additions and 41 deletions

View File

@@ -1,11 +1,15 @@
# 第一阶段:构建阶段
FROM golang:1.23.4-alpine AS builder
# 设置Go代理和Alpine镜像源
ENV GOPROXY https://goproxy.cn,direct
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
# 设置工作目录
WORKDIR /app
# 安装必要的包
RUN apk add --no-cache git ca-certificates tzdata
RUN apk add --no-cache git tzdata
# 复制模块文件
COPY go.mod go.sum ./
@@ -30,9 +34,11 @@ RUN BUILD_TIME=${BUILD_TIME:-$(date -u +"%Y-%m-%dT%H:%M:%SZ")} && \
# 第二阶段:运行阶段
FROM alpine:3.19
# 设置Alpine镜像源
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
# 安装必要的包
RUN apk --no-cache add ca-certificates tzdata curl && \
update-ca-certificates
RUN apk --no-cache add tzdata curl
# 设置时区
ENV TZ=Asia/Shanghai