chore: simplify build to fixed Tencent pip mirror
This commit is contained in:
@@ -15,8 +15,6 @@ LINGMA_MARKETPLACE_PUBLISHER=Alibaba-Cloud
|
||||
LINGMA_MARKETPLACE_EXTENSION=tongyi-lingma
|
||||
# VSIX 下载地址(最新优先)
|
||||
LINGMA_VSIX_URL=https://tongyi-code.oss-cn-hangzhou.aliyuncs.com/vscode/tongyi-lingma-latest.vsix
|
||||
# 构建 pip 源地区策略:auto/CN/GLOBAL
|
||||
PIP_REGION=auto
|
||||
# 启动时总是尝试从 VSIX 刷新二进制
|
||||
LINGMA_BOOTSTRAP_ALWAYS=true
|
||||
# 强制刷新(true 时忽略本地缓存)
|
||||
|
||||
35
Dockerfile
35
Dockerfile
@@ -7,40 +7,11 @@ ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||
|
||||
ARG PIP_INDEX_URL=https://mirrors.cloud.tencent.com/pypi/simple
|
||||
ARG PIP_TRUSTED_HOST=mirrors.cloud.tencent.com
|
||||
ARG PIP_REGION=auto
|
||||
|
||||
COPY requirements.txt /app/requirements.txt
|
||||
RUN set -e; \
|
||||
region="${PIP_REGION}"; \
|
||||
if [ "${region}" = "auto" ]; then \
|
||||
region=$(python - <<'PY'
|
||||
import urllib.request
|
||||
urls = [
|
||||
"https://ipapi.co/country/",
|
||||
"https://ifconfig.co/country-iso",
|
||||
]
|
||||
for u in urls:
|
||||
try:
|
||||
with urllib.request.urlopen(u, timeout=3) as r:
|
||||
v = r.read().decode("utf-8", errors="ignore").strip().upper()
|
||||
if v:
|
||||
print(v)
|
||||
raise SystemExit(0)
|
||||
except Exception:
|
||||
pass
|
||||
print("UNKNOWN")
|
||||
PY
|
||||
); \
|
||||
fi; \
|
||||
echo "[build] PIP region=${region}"; \
|
||||
if [ "${region}" = "CN" ]; then \
|
||||
pip install --no-cache-dir --retries 5 --timeout 120 \
|
||||
-i "${PIP_INDEX_URL}" --trusted-host "${PIP_TRUSTED_HOST}" \
|
||||
-r /app/requirements.txt \
|
||||
|| pip install --no-cache-dir --retries 5 --timeout 120 -r /app/requirements.txt; \
|
||||
else \
|
||||
pip install --no-cache-dir --retries 5 --timeout 120 -r /app/requirements.txt; \
|
||||
fi
|
||||
RUN pip install --no-cache-dir --retries 5 --timeout 120 \
|
||||
-i "${PIP_INDEX_URL}" --trusted-host "${PIP_TRUSTED_HOST}" \
|
||||
-r /app/requirements.txt
|
||||
|
||||
COPY app /app/app
|
||||
|
||||
|
||||
@@ -49,7 +49,6 @@ cp .env.example .env
|
||||
- `LINGMA_MARKETPLACE_PUBLISHER`:Marketplace 发布者
|
||||
- `LINGMA_MARKETPLACE_EXTENSION`:Marketplace 扩展名
|
||||
- `LINGMA_VSIX_URL`:VSIX 下载地址(最新优先)
|
||||
- `PIP_REGION`:构建 pip 源策略(`auto`/`CN`/`GLOBAL`)
|
||||
- `LINGMA_BOOTSTRAP_ALWAYS`:启动时是否总尝试刷新 Lingma
|
||||
- `LINGMA_FORCE_REFRESH`:是否强制刷新(忽略本地缓存)
|
||||
- `LINGMA_WORK_DIR`:Lingma 工作目录(登录与会话数据)
|
||||
@@ -79,7 +78,6 @@ LINGMA_SOURCE_TYPE=marketplace
|
||||
LINGMA_MARKETPLACE_PUBLISHER=Alibaba-Cloud
|
||||
LINGMA_MARKETPLACE_EXTENSION=tongyi-lingma
|
||||
LINGMA_VSIX_URL=https://tongyi-code.oss-cn-hangzhou.aliyuncs.com/vscode/tongyi-lingma-latest.vsix
|
||||
PIP_REGION=auto
|
||||
DEDICATED_DOMAIN_URL=
|
||||
```
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ services:
|
||||
args:
|
||||
PIP_INDEX_URL: https://mirrors.cloud.tencent.com/pypi/simple
|
||||
PIP_TRUSTED_HOST: mirrors.cloud.tencent.com
|
||||
PIP_REGION: auto
|
||||
container_name: lingma-openai-gateway
|
||||
env_file:
|
||||
- .env
|
||||
|
||||
Reference in New Issue
Block a user