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