fix: build-and-deploy 阶段使用自定义工具镜像
ci/woodpecker/push/woodpecker Pipeline failed

- 更新 build-and-deploy 阶段使用 *tools_image
- 重构 Dockerfile.tools: 基于 node:20-alpine,添加 git/ssh/rsync/curl/dig/nc
- 镜像大小: 60.5MB (包含 Node.js 20 + 所有工具)
- 移除临时安装 SSH/rsync 的步骤
This commit is contained in:
张翔
2026-03-31 17:35:14 +08:00
parent 3ce31d3178
commit 1db8cbdf97
2 changed files with 12 additions and 8 deletions
+7 -4
View File
@@ -113,7 +113,7 @@ steps:
- dev
build-and-deploy:
image: *node_image
image: *tools_image
environment:
NODE_ENV: production
NEXT_TELEMETRY_DISABLED: 1
@@ -124,9 +124,12 @@ steps:
- lint
- type-check
commands:
- echo "Checking SSH client availability"
- which ssh && echo "SSH client found" || echo "Installing SSH client"
- apk add --no-cache openssh-client rsync
- echo "=== 构建并部署到生产环境 ==="
- echo "当前容器信息:"
- 'echo "主机名: $(hostname)"'
- 'echo "IP地址: $(hostname -i)"'
- 'echo "可用工具: $(which ssh rsync git curl dig nc)"'
- echo ""
- echo "Building production artifacts"
- npm run build
- echo "Build completed"
+5 -4
View File
@@ -1,12 +1,13 @@
FROM --platform=linux/amd64 alpine:3.17
FROM --platform=linux/amd64 node:20-alpine
# 安装所需的工具
# 安装额外的工具
RUN apk add --no-cache \
git \
openssh-client \
curl \
bind-tools \
netcat-openbsd
netcat-openbsd \
rsync
# 设置时区
RUN apk add --no-cache tzdata && \
@@ -14,7 +15,7 @@ RUN apk add --no-cache tzdata && \
echo "Asia/Shanghai" > /etc/timezone
# 创建非root用户
RUN addgroup -g 1001 -S appgroup && \
RUN addgroup -g 1001 appgroup && \
adduser -u 1001 -S appuser -G appgroup
USER appuser