From d245d3bce88fefe3b6e047ef44026093953974c8 Mon Sep 17 00:00:00 2001 From: zhouyonggao <1971162852@qq.com> Date: Tue, 2 Dec 2025 17:10:36 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E6=9B=B4=E6=96=B0.gitignore=E5=B9=B6?= =?UTF-8?q?=E4=BC=98=E5=8C=96Docker=E6=9E=84=E5=BB=BA=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加marketing-system-data-tool.tar到.gitignore 在Dockerfile和部署脚本中增加GOPROXY配置以加速构建 --- .gitignore | 3 ++- Dockerfile | 4 +++- scripts/deploy_docker.sh | 2 ++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 11ea277..e18147e 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ server/config.test.yaml server/config.prod.yaml server/config.yaml server/bin/ -scripts/*.tar \ No newline at end of file +scripts/*.tar +marketing-system-data-tool.tar diff --git a/Dockerfile b/Dockerfile index d49ffac..c1df48c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,12 +3,14 @@ ARG TARGETOS=linux ARG TARGETARCH=amd64 ARG TARGETVARIANT="" ENV CGO_ENABLED=0 +ARG GOPROXY=https://goproxy.cn,direct +ENV GOPROXY=$GOPROXY WORKDIR /app RUN apk add --no-cache git COPY server/ ./server/ COPY web/ ./web/ WORKDIR /app/server -RUN GOOS=$TARGETOS GOARCH=$TARGETARCH GOARM=$(echo $TARGETVARIANT | sed 's/^v//') go build -o /app/bin/marketing-data-server ./cmd/server +RUN go env -w GOPROXY=$GOPROXY && GOOS=$TARGETOS GOARCH=$TARGETARCH GOARM=$(echo $TARGETVARIANT | sed 's/^v//') go build -o /app/bin/marketing-data-server ./cmd/server FROM alpine:3.19 WORKDIR /app diff --git a/scripts/deploy_docker.sh b/scripts/deploy_docker.sh index 7187162..f0b4d64 100644 --- a/scripts/deploy_docker.sh +++ b/scripts/deploy_docker.sh @@ -10,11 +10,13 @@ if docker image inspect "$IMAGE:$TAG" >/dev/null 2>&1; then echo "使用已有镜像作为缓存: $IMAGE:$TAG" DOCKER_BUILDKIT=1 docker build \ --build-arg BUILDKIT_INLINE_CACHE=1 \ + --build-arg GOPROXY="${GOPROXY:-https://goproxy.cn,direct}" \ --cache-from "$IMAGE:$TAG" -t "$IMAGE:$TAG" -f Dockerfile . else echo "镜像不存在,开始构建: $IMAGE:$TAG" DOCKER_BUILDKIT=1 docker build \ --build-arg BUILDKIT_INLINE_CACHE=1 \ + --build-arg GOPROXY="${GOPROXY:-https://goproxy.cn,direct}" \ -t "$IMAGE:$TAG" -f Dockerfile . fi mkdir -p log storage/export