refactor: remove GOPROXY injection logic from deploy.sh, already in Dockerfile
This commit is contained in:
@@ -60,25 +60,7 @@ setup_docker_mirror() {
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------
|
||||
# 3. 注入 Go 模块代理到 Dockerfile
|
||||
# ----------------------------------------------------------
|
||||
setup_go_proxy() {
|
||||
local dockerfile="Dockerfile"
|
||||
local proxy_env="GOPROXY=https://goproxy.cn,direct"
|
||||
|
||||
if grep -q "GOPROXY" "$dockerfile"; then
|
||||
warn "Dockerfile 已配置 GOPROXY,跳过"
|
||||
return
|
||||
fi
|
||||
|
||||
info "注入 Go 模块代理到 Dockerfile..."
|
||||
# 在 builder 阶段的 RUN go mod download 之前注入 ENV
|
||||
sed -i "/^RUN go mod download$/i ENV ${proxy_env}" "$dockerfile"
|
||||
info "Go 模块代理配置完成"
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------
|
||||
# 4. 读取 .env 配置文件
|
||||
# 3. 读取 .env 配置文件
|
||||
# ----------------------------------------------------------
|
||||
load_env() {
|
||||
if [ ! -f ".env" ]; then
|
||||
@@ -152,7 +134,6 @@ main() {
|
||||
|
||||
check_docker
|
||||
setup_docker_mirror
|
||||
setup_go_proxy
|
||||
load_env
|
||||
build_and_start
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user