chat-ui


使用docker部署chat-ui

Dockerfile

1
2
3
4
5
6
7
8
9
10
11
FROM node:20.2.0-bullseye-slim

WORKDIR /usr/src/app

COPY . .

RUN npm install

EXPOSE 9934

CMD [ "npm", "run", "dev", "--", "--port=9934" ]

修改package.json

1
2
3
4
5
"scripts": {
"dev": "vite --host 0.0.0.0",
"build": "vite build",
"preview": "vite preview --host 0.0.0.0"
},

构建docker image

1
docker build -t chat-ui .

启动

1
2
暴露9933端口
docker run -p 9934:9934 --restart=always --name="chat-ui" -d chat-ui

nginx

1
2
3
4
5
6
7
8
location ^~ / {
proxy_pass http://127.0.0.1:9934/;
proxy_buffering on;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Port $server_port;
}