diff --git a/deploy/docker-compose.dev.yml b/deploy/docker-compose.dev.yml index e249a6bd..0848e8c1 100644 --- a/deploy/docker-compose.dev.yml +++ b/deploy/docker-compose.dev.yml @@ -34,8 +34,10 @@ services: retries: 10 minio: - image: minio/minio:RELEASE.2025-09-07T16-13-09Z + # Docker Hub 已下线 minio/minio,legacy 仓库继续提供同一套 MinIO 开发镜像。 + image: bitnamilegacy/minio:2025.7.23-debian-12-r5 container_name: hfb-minio + user: "0" restart: unless-stopped command: server /data --console-address ":9001" environment: diff --git a/scripts/dev.sh b/scripts/dev.sh index fb9ed8ee..e07bc6b7 100755 --- a/scripts/dev.sh +++ b/scripts/dev.sh @@ -35,6 +35,9 @@ AUTO_KILL_PORTS="${DEV_AUTO_KILL_PORTS:-1}" FORCE_NPM_CI="${DEV_FORCE_NPM_CI:-0}" GOOSE_VERSION="${GOOSE_VERSION:-v3.27.1}" GOOSE_BIN="${GOOSE_BIN:-}" +# 开发脚本与 Dockerfile 保持一致的 Go 模块代理,避免默认代理在本地网络不可达。 +GOPROXY="${DEV_GOPROXY:-${GOPROXY:-https://goproxy.cn,direct}}" +export GOPROXY BACKEND_PID="" FRONTEND_PID="" @@ -116,6 +119,8 @@ show_help() { 前后端端口被占用时自动停止占用的 Docker 容器或本机进程 DEV_FORCE_NPM_CI=0 强制重新执行前端 npm ci + DEV_GOPROXY=https://goproxy.cn,direct + Go 模块代理,默认使用 goproxy.cn 示例: ./scripts/dev.sh # 正常启动(后端 + 主前后台 + 分销前台) @@ -439,13 +444,22 @@ reset_database() { } ensure_goose() { + local gopath_goose + if [[ -z "${GOOSE_BIN}" ]]; then GOOSE_BIN="$(command -v goose || true)" fi if [[ -z "${GOOSE_BIN}" ]]; then need_cmd go - log "未找到 goose,正在安装 ${GOOSE_VERSION}..." + gopath_goose="$(go env GOPATH)/bin/goose" + if [[ -x "${gopath_goose}" ]]; then + GOOSE_BIN="${gopath_goose}" + fi + fi + + if [[ -z "${GOOSE_BIN}" ]]; then + log "未找到 goose,正在使用 ${GOPROXY} 安装 ${GOOSE_VERSION}..." (cd "${ROOT_DIR}/backend" && go install "github.com/pressly/goose/v3/cmd/goose@${GOOSE_VERSION}") GOOSE_BIN="$(go env GOPATH)/bin/goose" fi