# 常用包 ARG node_modules = "typescript tslint-to-eslint-config prettier" # 以 -g 方式安装 RUN su node -c "umask 0002 && npm install -g ${node_modules}" \ && npm cache clean --force > /dev/null 2>&1 # 工作目录 WORKDIR /workspace # 挂载卷 VOLUME /workspace # 复制程序代码 COPY . . # 暴露常用端口,http,vite EXPOSE 8080 5173 # 默认启用命令行 CMD ["bash"] # 复制宿主机的时区,覆盖容器的时区,避免时间不同步问题,无额外依赖 RUN ln -sf /usr/share/zoneinfo/PRC /etc/localtime # 安装核心工具集和 CA 证书 RUN apt-get update && \ apt-get install -y --no-install-recommends \ ca-certificates \ curl \ wget \ vim \ git \ zsh && \ apt-get clean && \ rm -rf /var/lib/apt/lists/*