mm
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
|
||||
# 常用包
|
||||
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/*
|
||||
@@ -0,0 +1 @@
|
||||
npm install
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"name": "Node-Ts-Git",
|
||||
"image": "mcr.microsoft.com/devcontainers/typescript-node:5-24-trixie",
|
||||
"updateContentCommand": "bash ./.devcontainer/build.sh",
|
||||
"postCreateCommand": "bash ./.devcontainer/setup.sh",
|
||||
"forwardPorts": [3000, 5173, 8080],
|
||||
"customizations": {
|
||||
"vscode": {
|
||||
"extensions": ["esbenp.prettier-vscode", "dbaeumer.vscode-eslint"]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
node_modules="typescript tslint-to-eslint-config prettier"
|
||||
sudo chown -R node ${containerWorkspaceFolder}/node_modules
|
||||
sudo chown -R node ${containerWorkspaceFolder}/build
|
||||
[ -f package.json ]
|
||||
npm install -g ${node_modules}"
|
||||
Reference in New Issue
Block a user