fix: 合并冲突后重写 Dockerfile (3阶段构建 + alpine mirror + GOTOOLCHAIN)

This commit is contained in:
attacker committed 2026-06-18 03:38:22 +00:00
1 parent 3a0f5ddb52
commit 3dec5eec2a
1 file changed
+6 -17
+6 -17
View File
@@ -11,20 +11,14 @@ FROM golang:1.21-alpine AS builder
WORKDIR /app
<<<<<<< HEAD
=======
# 使用国内 Alpine 镜像源加速
# 使用国内 Alpine 镜像源加速 // Logan.Li
RUN sed -i 's|dl-cdn.alpinelinux.org|mirrors.aliyun.com|g' /etc/apk/repositories
# 安装构建依赖
>>>>>>> ca18ead (feat: run.sh四模式(dev/docker/build/binary) + CLI flags + Redka内嵌Redis + Agent复制修复 + 服务器编辑IP字段 + 安装Agent按钮)
RUN apk add --no-cache git ca-certificates tzdata
ENV TZ=Asia/Shanghai
ENV GOPROXY=https://goproxy.cn,direct
# 跳过 toolchain 校验(GOTOOLCHAIN 自动下载 Go 1.22)
# 跳过 toolchain 校验(GOTOOLCHAIN 自动下载 Go 1.22 给 Redka 用)// Logan.Li
ENV GONOSUMCHECK=*
# 自动下载 Go 1.22 工具链(Redka 需要)
ENV GOTOOLCHAIN=go1.22.2
# 复制后端 go.mod(利用 Docker 层缓存)
@@ -34,7 +28,7 @@ RUN go mod download
# 复制后端源码
COPY backend/ ./
# 构建后端二进制
# 构建后端二进制(Redka 需要 Go 1.22,由 GOTOOLCHAIN 自动下载)
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build \
-ldflags="-w -s" \
-o ezops ./cmd/
@@ -62,16 +56,11 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o bin/aiop
# ==================== Stage 3: Runtime ====================
FROM alpine:latest
<<<<<<< HEAD
# 安装运行时依赖(curl=健康检查,openssh-client=SSH远程安装agent)
RUN apk --no-cache add ca-certificates tzdata curl openssh-client
=======
# 使用国内 Alpine 镜像源加速
# 使用国内 Alpine 镜像源加速 // Logan.Li
RUN sed -i 's|dl-cdn.alpinelinux.org|mirrors.aliyun.com|g' /etc/apk/repositories
# 安装运行时依赖
RUN apk --no-cache add ca-certificates tzdata curl
>>>>>>> ca18ead (feat: run.sh四模式(dev/docker/build/binary) + CLI flags + Redka内嵌Redis + Agent复制修复 + 服务器编辑IP字段 + 安装Agent按钮)
# 安装运行时依赖(curl=健康检查,openssh-client=SSH远程安装agent)
RUN apk --no-cache add ca-certificates tzdata curl openssh-client
ENV TZ=Asia/Shanghai