【前端源文件】添加容器运行,还需要测试

This commit is contained in:
sugar1569 2024-03-12 21:04:24 +08:00
parent 2782863402
commit 086816ec78
3 changed files with 42 additions and 0 deletions

20
template/admin/Dockerfile Normal file
View File

@ -0,0 +1,20 @@
# 使用官方的 Node.js 14 作为父镜像
FROM node:14 AS crmeb
# 设置工作目录为 /app
WORKDIR /app
# 将当前目录内容复制到容器的 /app 内
COPY package.json /app
# 安装任何需要的包
RUN npm install
# 对外暴露的端口号
EXPOSE 1617
# 定义环境变量
ENV NODE_ENV=development
# 当容器启动时运行 npm start
# CMD ["node","./index.js"]

View File

@ -292,4 +292,8 @@ $ npm run build
`$ VUE_APP_API_URL=''`
### docker开发调试
$ docker-compose up -d
### 访问地址
http://localhost:1617/admin

View File

@ -0,0 +1,18 @@
version: '5'
services:
node-web:
container_name: CRMEBv5
image: crmeb
build:
context: .
dockerfile: Dockerfile
ports:
- "1617:1617"
volumes:
- .:/app
- /app/node_modules
working_dir: /app
# 开发调试
command: ["npm","run","dev"]
# 正式版打包
# command: ["npm","run","build"]