🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
59 lines
1.5 KiB
Docker
59 lines
1.5 KiB
Docker
# 最小化 CI/CD 镜像,基于现有 node:20-alpine
|
|
FROM node:20-alpine
|
|
|
|
# 设置环境变量
|
|
ENV HTTP_PROXY=http://127.0.0.1:7890
|
|
ENV HTTPS_PROXY=http://127.0.0.1:7890
|
|
ENV NO_PROXY=localhost,127.0.0.1,192.168.1.83,192.168.1.83:33000,192.168.1.83:8443
|
|
ENV TZ=Asia/Shanghai
|
|
|
|
# 安装必要工具(最小安装)
|
|
RUN apk add --no-cache \
|
|
git \
|
|
curl \
|
|
wget \
|
|
unzip \
|
|
zip \
|
|
jq \
|
|
ca-certificates \
|
|
bash \
|
|
python3 \
|
|
py3-pip \
|
|
&& rm -rf /var/cache/apk/*
|
|
|
|
# 设置时区
|
|
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
|
|
|
# 配置 NPM - 使用国内镜像源和代理
|
|
RUN npm config set registry https://registry.npmmirror.com \
|
|
&& npm config set proxy http://127.0.0.1:7890 \
|
|
&& npm config set https-proxy http://127.0.0.1:7890
|
|
|
|
# 配置 PIP - 使用国内镜像源
|
|
RUN mkdir -p ~/.pip \
|
|
&& cat > ~/.pip/pip.conf << 'EOF'
|
|
[global]
|
|
trusted-host = mirrors.aliyun.com
|
|
pypi.org
|
|
pypi.python.org
|
|
files.pythonhosted.org
|
|
index-url = https://mirrors.aliyun.com/pypi/simple/
|
|
timeout = 60
|
|
EOF
|
|
|
|
# 配置 Git 优化
|
|
RUN git config --global core.preloadindex true \
|
|
&& git config --global core.fscache true \
|
|
&& git config --global gc.auto 256 \
|
|
&& git config --global submodule.fetchJobs 4
|
|
|
|
# 创建工作目录
|
|
WORKDIR /workspace
|
|
|
|
# 添加标签
|
|
LABEL maintainer="bookstore-team"
|
|
LABEL description="Minimal Node.js Alpine CI/CD base image with proxy support"
|
|
LABEL version="1.0.0"
|
|
|
|
# 设置默认命令
|
|
CMD ["/bin/bash"] |