fix(dev): 修复本地 MinIO 与 Go 依赖启动
This commit is contained in:
@@ -34,8 +34,10 @@ services:
|
|||||||
retries: 10
|
retries: 10
|
||||||
|
|
||||||
minio:
|
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
|
container_name: hfb-minio
|
||||||
|
user: "0"
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
command: server /data --console-address ":9001"
|
command: server /data --console-address ":9001"
|
||||||
environment:
|
environment:
|
||||||
|
|||||||
+15
-1
@@ -35,6 +35,9 @@ AUTO_KILL_PORTS="${DEV_AUTO_KILL_PORTS:-1}"
|
|||||||
FORCE_NPM_CI="${DEV_FORCE_NPM_CI:-0}"
|
FORCE_NPM_CI="${DEV_FORCE_NPM_CI:-0}"
|
||||||
GOOSE_VERSION="${GOOSE_VERSION:-v3.27.1}"
|
GOOSE_VERSION="${GOOSE_VERSION:-v3.27.1}"
|
||||||
GOOSE_BIN="${GOOSE_BIN:-}"
|
GOOSE_BIN="${GOOSE_BIN:-}"
|
||||||
|
# 开发脚本与 Dockerfile 保持一致的 Go 模块代理,避免默认代理在本地网络不可达。
|
||||||
|
GOPROXY="${DEV_GOPROXY:-${GOPROXY:-https://goproxy.cn,direct}}"
|
||||||
|
export GOPROXY
|
||||||
|
|
||||||
BACKEND_PID=""
|
BACKEND_PID=""
|
||||||
FRONTEND_PID=""
|
FRONTEND_PID=""
|
||||||
@@ -116,6 +119,8 @@ show_help() {
|
|||||||
前后端端口被占用时自动停止占用的 Docker 容器或本机进程
|
前后端端口被占用时自动停止占用的 Docker 容器或本机进程
|
||||||
DEV_FORCE_NPM_CI=0
|
DEV_FORCE_NPM_CI=0
|
||||||
强制重新执行前端 npm ci
|
强制重新执行前端 npm ci
|
||||||
|
DEV_GOPROXY=https://goproxy.cn,direct
|
||||||
|
Go 模块代理,默认使用 goproxy.cn
|
||||||
|
|
||||||
示例:
|
示例:
|
||||||
./scripts/dev.sh # 正常启动(后端 + 主前后台 + 分销前台)
|
./scripts/dev.sh # 正常启动(后端 + 主前后台 + 分销前台)
|
||||||
@@ -439,13 +444,22 @@ reset_database() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ensure_goose() {
|
ensure_goose() {
|
||||||
|
local gopath_goose
|
||||||
|
|
||||||
if [[ -z "${GOOSE_BIN}" ]]; then
|
if [[ -z "${GOOSE_BIN}" ]]; then
|
||||||
GOOSE_BIN="$(command -v goose || true)"
|
GOOSE_BIN="$(command -v goose || true)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z "${GOOSE_BIN}" ]]; then
|
if [[ -z "${GOOSE_BIN}" ]]; then
|
||||||
need_cmd go
|
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}")
|
(cd "${ROOT_DIR}/backend" && go install "github.com/pressly/goose/v3/cmd/goose@${GOOSE_VERSION}")
|
||||||
GOOSE_BIN="$(go env GOPATH)/bin/goose"
|
GOOSE_BIN="$(go env GOPATH)/bin/goose"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user