修改好第三次配置

This commit is contained in:
小贺
2025-09-02 23:01:23 +08:00
parent b3d00f1a12
commit e54db74be5
6 changed files with 8 additions and 10 deletions

View File

View File

@@ -2,7 +2,7 @@ FROM python:3.11-slim
WORKDIR /app WORKDIR /app
# 安装依赖 # 安装依赖
RUN pip install --no-cache-dir fastapi==0.115.8 uvicorn[standard]==0.34.8 python-multipart RUN pip install --no-cache-dir fastapi==0.115.8 uvicorn[standard]==0.34.4 python-multipart
# 复制代码 # 复制代码
COPY . . COPY . .

View File

@@ -6,7 +6,7 @@ services:
context: ./front context: ./front
dockerfile: dockerfile dockerfile: dockerfile
ports: ports:
- "80:80" - "5555:5555" # 修改为5555端口映射
depends_on: depends_on:
- backend - backend
networks: networks:

View File

@@ -11,5 +11,5 @@ FROM nginx:alpine
COPY --from=build /app/dist /usr/share/nginx/html COPY --from=build /app/dist /usr/share/nginx/html
# 复制nginx配置 # 复制nginx配置
COPY nginx.conf /etc/nginx/nginx.conf COPY nginx.conf /etc/nginx/nginx.conf
EXPOSE 80 EXPOSE 5555
CMD ["nginx", "-g", "daemon off;"] CMD ["nginx", "-g", "daemon off;"]

View File

@@ -8,7 +8,7 @@ http {
# 配置前端路由支持SPA单页应用 # 配置前端路由支持SPA单页应用
server { server {
listen 80; listen 5555;
server_name localhost; server_name localhost;
root /usr/share/nginx/html; root /usr/share/nginx/html;

View File

@@ -7,19 +7,17 @@ export default defineConfig({
server: { server: {
// 监听所有IP地址 // 监听所有IP地址
host: "0.0.0.0", host: "0.0.0.0",
// 指定dev sever的端口号 // 指定dev sever的端口号为5555
port: 3000, port: 5555,
// 自动打开浏览器运行以下页面 // 自动打开浏览器运行以下页面
open: "/", open: "/",
// 设置反向代理 // 设置反向代理
proxy: { proxy: {
// 以下示例表示请求URL中含有"/api",则反向代理到http://localhost // 以下示例表示请求URL中含有"/api",则反向代理到后端
// 例如: http://localhost:3000/api/login -> http://localhost/api/login
"/api": { "/api": {
target: "http://localhost:5000/", target: "http://localhost:5000/",
changeOrigin: true, changeOrigin: true,
}, },
}, },
}, },
}); });