Dockerfile 1.3 KB

1234567891011121314151617181920212223242526272829303132
  1. # production stage
  2. FROM nginx as production-stage
  3. #COPY --from=build-stage ./dist /usr/share/nginx/html
  4. RUN echo "server { \
  5. listen 80; \
  6. location /shop-api/ { \
  7. proxy_pass http://69.230.201.115:8088/shop-api/; \
  8. proxy_redirect off; \
  9. proxy_set_header Host http://69.230.201.115:8088; \
  10. proxy_set_header X-Real-IP \$remote_addr; \
  11. proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for; \
  12. } \
  13. #解决Router(mode: 'history')模式下,刷新路由地址不能找到页面的问题 \
  14. location / { \
  15. root /var/www/html/; \
  16. index index.html index.htm; \
  17. if (!-e \$request_filename) { \
  18. rewrite ^(.*)\$ /index.html?s=\$1 last; \
  19. break; \
  20. } \
  21. } \
  22. access_log /var/log/nginx/access.log ; \
  23. } " > /etc/nginx/conf.d/default.conf \
  24. && mkdir -p /var/www \
  25. && mkdir -p /var/www/html
  26. ADD /jeecgboot-vue3/dist/ /var/www/html/
  27. # 暴露镜像端口
  28. EXPOSE 80
  29. EXPOSE 443
  30. CMD ["nginx","-g","daemon off"]