change some Dockerfile
Change-Id: I0404b5516ce32df5e88a23906a929cda6b5fb0f8
diff --git a/Dockerfile b/Dockerfile
index 99ba20b..30091d9 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,18 +1,21 @@
-# 构建阶段
-FROM node:16 as build
+# 基础镜像
+FROM node:16
+
+# 设置工作目录
WORKDIR /app
+
+# 复制package.json和package-lock.json
COPY package*.json ./
+
# 使用淘宝镜像源安装依赖
RUN npm config set registry https://registry.npmmirror.com && \
npm install
+
+# 复制项目文件
COPY . .
-RUN npm run build
-# 生产阶段
-FROM nginx:alpine
-COPY --from=build /app/dist /usr/share/nginx/html
-COPY nginx.conf /etc/nginx/conf.d/default.conf
-
+# 暴露端口
EXPOSE 3004
-CMD ["nginx", "-g", "daemon off;"]
\ No newline at end of file
+# 启动应用
+CMD ["npm", "run", "start"]
\ No newline at end of file
diff --git a/nginx.conf b/nginx.conf
index a69c4cb..2a1b5db 100644
--- a/nginx.conf
+++ b/nginx.conf
@@ -1,5 +1,5 @@
server {
- listen 3004; # 修改为Docker Compose中映射的前端端口(与docker-compose.yml保持一致)
+ listen 3004; # 修改为Docker Compose中映射的前端端口
server_name _; # 允许所有域名访问
@@ -12,11 +12,7 @@
# 反向代理API请求到后端
location /api/ {
-<<<<<<< HEAD
- proxy_pass http://backend/; # 保持相对路径
-=======
proxy_pass http://team4.10813352.xyz:5004; # 代理路径与后端API前缀匹配
->>>>>>> 16ac8f6a916a433ddbdd363b7be8246307e76f01
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;