chore: 更新版本号并优化Docker构建顺序
- 将版本号从2.10.3.2更新至2.10.3.3 - 调整Dockerfile中复制tls-sidecar二进制文件的位置,避免被本地文件覆盖 - 在tls-sidecar启动时增加Linux/macOS平台下的执行权限设置 - 增强二进制文件存在性检查,确保目标为常规文件
This commit is contained in:
parent
65cdcaa3b5
commit
1798fc3df1
3 changed files with 17 additions and 7 deletions
11
Dockerfile
11
Dockerfile
|
|
@ -22,10 +22,6 @@ LABEL description="Docker image for AIClient2API server"
|
||||||
# 安装必要的系统工具(tar 用于更新功能,git 用于版本检查)
|
# 安装必要的系统工具(tar 用于更新功能,git 用于版本检查)
|
||||||
RUN apk add --no-cache tar git
|
RUN apk add --no-cache tar git
|
||||||
|
|
||||||
# 从 sidecar 构建阶段复制二进制
|
|
||||||
COPY --from=sidecar-builder /build/tls-sidecar /app/tls-sidecar/tls-sidecar
|
|
||||||
RUN chmod +x /app/tls-sidecar/tls-sidecar
|
|
||||||
|
|
||||||
# 设置工作目录
|
# 设置工作目录
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
|
|
@ -40,6 +36,11 @@ RUN npm install
|
||||||
# 复制源代码
|
# 复制源代码
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
|
# 从 sidecar 构建阶段复制二进制
|
||||||
|
# 放在 COPY . . 之后是为了确保不会被本地的空目录或旧二进制文件覆盖
|
||||||
|
COPY --from=sidecar-builder /build/tls-sidecar /app/tls-sidecar/tls-sidecar
|
||||||
|
RUN chmod +x /app/tls-sidecar/tls-sidecar
|
||||||
|
|
||||||
USER root
|
USER root
|
||||||
|
|
||||||
# 创建目录用于存储日志和系统提示文件
|
# 创建目录用于存储日志和系统提示文件
|
||||||
|
|
@ -55,4 +56,4 @@ HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
||||||
# 设置启动命令
|
# 设置启动命令
|
||||||
# 使用默认配置启动服务器,支持通过环境变量配置
|
# 使用默认配置启动服务器,支持通过环境变量配置
|
||||||
# 通过环境变量传递参数,例如:docker run -e ARGS="--api-key mykey --port 8080" ...
|
# 通过环境变量传递参数,例如:docker run -e ARGS="--api-key mykey --port 8080" ...
|
||||||
CMD ["sh", "-c", "node src/core/master.js $ARGS"]
|
CMD ["sh", "-c", "node src/core/master.js $ARGS"]
|
||||||
|
|
|
||||||
2
VERSION
2
VERSION
|
|
@ -1 +1 @@
|
||||||
2.10.3.2
|
2.10.3.3
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,15 @@ class TLSSidecar {
|
||||||
logger.info(`[TLS-Sidecar] Starting: ${binaryPath} on port ${this.port}`);
|
logger.info(`[TLS-Sidecar] Starting: ${binaryPath} on port ${this.port}`);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
// 确保 Linux/macOS 下有执行权限
|
||||||
|
if (process.platform !== 'win32') {
|
||||||
|
try {
|
||||||
|
fs.chmodSync(binaryPath, 0o755);
|
||||||
|
} catch (e) {
|
||||||
|
logger.warn(`[TLS-Sidecar] Failed to chmod binary: ${e.message}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.process = spawn(binaryPath, [], {
|
this.process = spawn(binaryPath, [], {
|
||||||
env: {
|
env: {
|
||||||
...process.env,
|
...process.env,
|
||||||
|
|
@ -211,7 +220,7 @@ class TLSSidecar {
|
||||||
|
|
||||||
for (const p of candidates) {
|
for (const p of candidates) {
|
||||||
try {
|
try {
|
||||||
if (fs.existsSync(p)) {
|
if (fs.existsSync(p) && fs.statSync(p).isFile()) {
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
} catch { /* ignore */ }
|
} catch { /* ignore */ }
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue