diff --git a/Dockerfile b/Dockerfile index 6914713..7847f82 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,5 @@ -FROM golang:1.21-alpine AS build +ARG BASE_REGISTRY=docker.io +FROM ${BASE_REGISTRY}/library/golang:1.21-alpine AS build ARG ALPINE_MIRROR=mirrors.aliyun.com RUN sed -i "s/dl-cdn.alpinelinux.org/${ALPINE_MIRROR}/g" /etc/apk/repositories || true ARG GOPROXY=https://goproxy.cn,direct @@ -10,7 +11,8 @@ COPY web/ ./web/ WORKDIR /app/server RUN go env -w GOPROXY=$GOPROXY && go build -o /app/bin/marketing-data-server ./cmd/server -FROM alpine:3.19 +ARG BASE_REGISTRY=docker.io +FROM ${BASE_REGISTRY}/library/alpine:3.19 ARG ALPINE_MIRROR=mirrors.aliyun.com RUN sed -i "s/dl-cdn.alpinelinux.org/${ALPINE_MIRROR}/g" /etc/apk/repositories || true WORKDIR /app diff --git a/scripts/deploy_docker.sh b/scripts/deploy_docker.sh index fde7363..1e04079 100644 --- a/scripts/deploy_docker.sh +++ b/scripts/deploy_docker.sh @@ -12,6 +12,7 @@ if docker image inspect "$IMAGE:$TAG" >/dev/null 2>&1; then --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}" \ --cache-from "$IMAGE:$TAG" -t "$IMAGE:$TAG" -f Dockerfile . else echo "镜像不存在,开始构建: $IMAGE:$TAG" @@ -19,6 +20,7 @@ else --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}" \ -t "$IMAGE:$TAG" -f Dockerfile . fi mkdir -p log storage/export