kevin1207 commited on
Commit
5395421
·
verified ·
1 Parent(s): 7931c93

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +4 -1
Dockerfile CHANGED
@@ -47,6 +47,9 @@ RUN sudo find / \
47
 
48
  COPY --from=build-stage /app/dist /usr/share/nginx/html
49
  COPY --from=build-stage /app/nginx.conf /etc/nginx/conf.d/default.conf
 
 
 
50
 
51
  # 确保 Nginx 目录的权限正确
52
  RUN chown -R nginx:nginx /usr/share/nginx/html && \
@@ -55,7 +58,7 @@ RUN chown -R nginx:nginx /usr/share/nginx/html && \
55
  # 使用非 root 用户运行
56
  USER nginx
57
 
58
- EXPOSE 80
59
 
60
  CMD ["nginx", "-g", "daemon off;"]
61
 
 
47
 
48
  COPY --from=build-stage /app/dist /usr/share/nginx/html
49
  COPY --from=build-stage /app/nginx.conf /etc/nginx/conf.d/default.conf
50
+ # 修改 Nginx 配置中的端口从 80 改为 8080
51
+ RUN sed -i 's/listen\s*80/listen 8080/g' /etc/nginx/conf.d/default.conf && \
52
+ sed -i 's/listen\s*\[::\]:80/listen [::]:8080/g' /etc/nginx/conf.d/default.conf
53
 
54
  # 确保 Nginx 目录的权限正确
55
  RUN chown -R nginx:nginx /usr/share/nginx/html && \
 
58
  # 使用非 root 用户运行
59
  USER nginx
60
 
61
+ EXPOSE 8080
62
 
63
  CMD ["nginx", "-g", "daemon off;"]
64