diff --git a/Dockerfile b/Dockerfile index 7847f82..f5d5a37 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,5 @@ -ARG BASE_REGISTRY=docker.io -FROM ${BASE_REGISTRY}/library/golang:1.21-alpine AS build -ARG ALPINE_MIRROR=mirrors.aliyun.com +ARG BASE_REGISTRY=repo.huaweicloud.com +FROM repo.huaweicloud.com/dockerhub/library/golang:1.21-alpine AS build RUN sed -i "s/dl-cdn.alpinelinux.org/${ALPINE_MIRROR}/g" /etc/apk/repositories || true ARG GOPROXY=https://goproxy.cn,direct ENV GOPROXY=$GOPROXY @@ -11,9 +10,7 @@ COPY web/ ./web/ WORKDIR /app/server RUN go env -w GOPROXY=$GOPROXY && go build -o /app/bin/marketing-data-server ./cmd/server -ARG BASE_REGISTRY=docker.io -FROM ${BASE_REGISTRY}/library/alpine:3.19 -ARG ALPINE_MIRROR=mirrors.aliyun.com +FROM ${BASE_REGISTRY}/dockerhub/library/alpine:3.19 RUN sed -i "s/dl-cdn.alpinelinux.org/${ALPINE_MIRROR}/g" /etc/apk/repositories || true WORKDIR /app COPY --from=build /app/bin/marketing-data-server /app/bin/marketing-data-server diff --git a/scripts/deploy_docker.sh b/scripts/deploy_docker.sh index 1e04079..d8dc693 100644 --- a/scripts/deploy_docker.sh +++ b/scripts/deploy_docker.sh @@ -11,16 +11,14 @@ if docker image inspect "$IMAGE:$TAG" >/dev/null 2>&1; then DOCKER_BUILDKIT=1 docker build \ --build-arg BUILDKIT_INLINE_CACHE=1 \ --build-arg GOPROXY="${GOPROXY:-https://goproxy.cn,direct}" \ - --build-arg ALPINE_MIRROR="${ALPINE_MIRROR:-mirrors.aliyun.com}" \ - --build-arg BASE_REGISTRY="${BASE_REGISTRY:-docker.io}" \ + --build-arg BASE_REGISTRY="${BASE_REGISTRY:-repo.huaweicloud.com}" \ --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}" \ - --build-arg ALPINE_MIRROR="${ALPINE_MIRROR:-mirrors.aliyun.com}" \ - --build-arg BASE_REGISTRY="${BASE_REGISTRY:-docker.io}" \ + --build-arg BASE_REGISTRY="${BASE_REGISTRY:-repo.huaweicloud.com}" \ -t "$IMAGE:$TAG" -f Dockerfile . fi mkdir -p log storage/export