diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy.yaml index 633ce33..6ecaa51 100644 --- a/.gitea/workflows/deploy.yaml +++ b/.gitea/workflows/deploy.yaml @@ -42,12 +42,12 @@ jobs: - name: 构建 API 镜像 run: | - docker build -f Dockerfile.api -t ${{ env.API_IMAGE }}:${{ steps.tag.outputs.tag }} . + DOCKER_BUILDKIT=1 docker build -f Dockerfile.api -t ${{ env.API_IMAGE }}:${{ steps.tag.outputs.tag }} . docker tag ${{ env.API_IMAGE }}:${{ steps.tag.outputs.tag }} ${{ env.API_IMAGE }}:${{ github.sha }} - name: 构建 Worker 镜像 run: | - docker build -f Dockerfile.worker -t ${{ env.WORKER_IMAGE }}:${{ steps.tag.outputs.tag }} . + DOCKER_BUILDKIT=1 docker build -f Dockerfile.worker -t ${{ env.WORKER_IMAGE }}:${{ steps.tag.outputs.tag }} . docker tag ${{ env.WORKER_IMAGE }}:${{ steps.tag.outputs.tag }} ${{ env.WORKER_IMAGE }}:${{ github.sha }} - name: 推送镜像到 Registry diff --git a/Dockerfile.api b/Dockerfile.api index 6f8b8a6..13f85a4 100644 --- a/Dockerfile.api +++ b/Dockerfile.api @@ -34,8 +34,11 @@ RUN go install -tags 'postgres' github.com/golang-migrate/migrate/v4/cmd/migrate # ================================ FROM alpine:3.19 +# 使用阿里云镜像源加速 +RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories + # 安装运行时依赖 -RUN apk add --no-cache ca-certificates tzdata bash curl +RUN apk add --no-cache ca-certificates tzdata bash # 设置时区 ENV TZ=Asia/Shanghai @@ -65,9 +68,9 @@ USER appuser # 暴露端口 EXPOSE 8088 -# 健康检查 +# 健康检查(使用 Alpine 自带的 wget) HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 \ - CMD curl -f http://localhost:8088/health || exit 1 + CMD wget --no-verbose --tries=1 --spider http://localhost:8088/health || exit 1 # 启动命令 ENTRYPOINT ["/app/entrypoint.sh"] diff --git a/Dockerfile.worker b/Dockerfile.worker index acb3a57..448317a 100644 --- a/Dockerfile.worker +++ b/Dockerfile.worker @@ -31,6 +31,9 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build \ # ================================ FROM alpine:3.19 +# 使用阿里云镜像源加速 +RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories + # 安装运行时依赖 RUN apk add --no-cache ca-certificates tzdata bash