Add Dockerfile (#33)

* add Dockerfile

* update Readme.md

* Fixed : Docker log file

* Update vite.config.ts
This commit is contained in:
Void 2023-02-16 13:39:07 +08:00 committed by GitHub
parent e9db25a970
commit 6646695849
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 46 additions and 0 deletions

6
.dockerignore Normal file
View File

@ -0,0 +1,6 @@
node_modules
Dockerfile
.git
.husky
.github
.vscode

19
Dockerfile Normal file
View File

@ -0,0 +1,19 @@
FROM node:lts
# copy resource
RUN mkdir /app
COPY ./ /app
WORKDIR /app
# build
RUN npm install pnpm -g
RUN pnpm bootstrap
WORKDIR /app/service
RUN pnpm install
WORKDIR /app
EXPOSE 1002
EXPOSE 3002
CMD ["/bin/bash","./start.sh"]

View File

@ -95,6 +95,16 @@ pnpm build
pnpm prod
```
## Docker build & run
```
docker rm -f $(docker ps -a| grep marlkiller/chatgpt-web | awk '{print $1}')
docker rmi $(docker images 'marlkiller/chatgpt-web' -q)
docker build -t marlkiller/chatgpt-web .
docker run -p 1002:1002 marlkiller/chatgpt-web
```
PS: 不进行打包,直接在服务器上运行 `pnpm start` 也可
### 网页

11
start.sh Normal file
View File

@ -0,0 +1,11 @@
cd ./service
nohup pnpm start > service.log &
echo "Start service complete!"
cd ..
echo "" > front.log
nohup pnpm dev > front.log &
echo "Start front complete!"
tail -f front.log