提交修复版 node.js 版本

This commit is contained in:
yxj52 2025-08-31 20:39:51 +08:00
parent 685c3186ea
commit e79f4e7549
3 changed files with 10 additions and 24 deletions

View File

@ -1,6 +1,5 @@
# 多阶段构建
# 第一阶段:构建阶段
FROM node:18-alpine as build-stage
# 使用Node.js开发环境
FROM node:18-alpine
# 设置工作目录
WORKDIR /app
@ -8,26 +7,14 @@ WORKDIR /app
# 复制package.json和package-lock.json
COPY package*.json ./
# 安装所有依赖(包括开发依赖用于构建
# 安装所有依赖(开发服务器需要开发依赖
RUN npm install
# 复制源代码
COPY . .
# 构建应用
RUN npm run build
# 第二阶段:生产阶段
FROM nginx:alpine as production-stage
# 复制自定义nginx配置
COPY nginx.conf /etc/nginx/nginx.conf
# 从构建阶段复制构建结果到nginx
COPY --from=build-stage /app/dist /usr/share/nginx/html
# 暴露端口
EXPOSE 80
EXPOSE 3000
# 启动nginx
CMD ["nginx", "-g", "daemon off;"]
# 启动开发服务器
CMD ["npm", "run", "dev"]

View File

@ -8,12 +8,10 @@ services:
dockerfile: Dockerfile
container_name: office-intelligent-drafting
ports:
- "12080:80"
- "12080:3000"
restart: unless-stopped
environment:
- NODE_ENV=production
volumes:
- ./logs/nginx:/var/log/nginx
- NODE_ENV=development
networks:
default:

View File

@ -4,8 +4,9 @@ import vue from '@vitejs/plugin-vue'
export default defineConfig({
plugins: [vue()],
server: {
host: '0.0.0.0',
port: 3000,
open: true,
open: false,
proxy: {
'/api': {
target: 'http://1.94.234.11:8080',