jxdn123 commited on
Commit
52f37c8
·
verified ·
1 Parent(s): 0ef8091

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +4 -9
Dockerfile CHANGED
@@ -16,14 +16,14 @@ RUN mkdir -p /var/cache/nginx/client_temp \
16
  /var/log/nginx \
17
  /app/cache
18
 
19
- # 创建 nginx 配置文件
20
  RUN cat > /etc/nginx/conf.d/default.conf <<'EOF'
21
  server {
22
  listen 7860;
23
  server_name _;
24
 
25
- # 前端静态文件
26
- root /usr/share/nginx/html;
27
  index index.html;
28
 
29
  # 前端路由
@@ -49,12 +49,6 @@ EOF
49
  RUN sed -i 's/^user\s/#user /g' /etc/nginx/nginx.conf && \
50
  sed -i 's|pid\s*/var/run/nginx.pid;|pid /tmp/nginx.pid;|g' /etc/nginx/nginx.conf
51
 
52
- # 在 RUN cat > /start.sh 之前添加
53
- RUN echo "Checking directory structure..." && \
54
- ls -la /usr/share/nginx/html || echo "No html dir" && \
55
- ls -la /app || echo "No app dir" && \
56
- find / -name "index.html" 2>/dev/null | head -5 || echo "No index.html found"
57
-
58
  # 创建启动脚本
59
  RUN cat > /start.sh <<'EOF'
60
  #!/bin/sh
@@ -76,6 +70,7 @@ else
76
  fi
77
 
78
  echo "Starting Nginx on port 7860..."
 
79
  # 启动 nginx(前台运行)
80
  exec nginx -g "daemon off;"
81
  EOF
 
16
  /var/log/nginx \
17
  /app/cache
18
 
19
+ # 创建 nginx 配置文件 - 指向正确的前端目录
20
  RUN cat > /etc/nginx/conf.d/default.conf <<'EOF'
21
  server {
22
  listen 7860;
23
  server_name _;
24
 
25
+ # 前端静态文件 - 正确的路径
26
+ root /app/frontend/dist;
27
  index index.html;
28
 
29
  # 前端路由
 
49
  RUN sed -i 's/^user\s/#user /g' /etc/nginx/nginx.conf && \
50
  sed -i 's|pid\s*/var/run/nginx.pid;|pid /tmp/nginx.pid;|g' /etc/nginx/nginx.conf
51
 
 
 
 
 
 
 
52
  # 创建启动脚本
53
  RUN cat > /start.sh <<'EOF'
54
  #!/bin/sh
 
70
  fi
71
 
72
  echo "Starting Nginx on port 7860..."
73
+ echo "Frontend files location: /app/frontend/dist"
74
  # 启动 nginx(前台运行)
75
  exec nginx -g "daemon off;"
76
  EOF