mirror of
https://github.com/vastxie/99AI.git
synced 2024-11-16 11:42:25 +08:00
简化部署流程
使用docker-compose一键启动
This commit is contained in:
parent
3bd4bb5df1
commit
70fce850c8
20
.dockerignore
Normal file
20
.dockerignore
Normal file
|
@ -0,0 +1,20 @@
|
|||
node_modules
|
||||
data
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
|
||||
### Macos ###
|
||||
.DS_Store
|
||||
.env
|
||||
.git
|
||||
.gitignore
|
||||
docker
|
||||
docs
|
||||
README.md
|
|
@ -4,7 +4,7 @@ PREFIX=/docs
|
|||
APIPREFIX=/api
|
||||
|
||||
# mysql
|
||||
DB_HOST=localhost
|
||||
DB_HOST=localhost # 使用docker-compose时值应该为mysql
|
||||
DB_PORT=3306
|
||||
DB_USER=root
|
||||
DB_PASS=
|
||||
|
@ -24,7 +24,7 @@ MAILER_FROM=
|
|||
|
||||
# Redis
|
||||
REDIS_PORT=6379
|
||||
REDIS_HOST=127.0.0.1
|
||||
REDIS_HOST=127.0.0.1 # 使用docker-compose时值应该为redis
|
||||
REDIS_PASSWORD=
|
||||
REDIS_USER=
|
||||
|
||||
|
|
19
Dockerfile
Normal file
19
Dockerfile
Normal file
|
@ -0,0 +1,19 @@
|
|||
# 编译阶段
|
||||
FROM node:18-alpine AS build
|
||||
|
||||
WORKDIR /app
|
||||
COPY . .
|
||||
|
||||
# 使用 pnpm 安装项目依赖
|
||||
RUN npm install -g pnpm
|
||||
RUN pnpm install
|
||||
|
||||
# 运行阶段
|
||||
FROM node:18-alpine
|
||||
ENV TZ="Asia/Shanghai"
|
||||
|
||||
WORKDIR /app
|
||||
COPY --from=build /app .
|
||||
EXPOSE 9520
|
||||
|
||||
CMD ["node", "./dist/main.js"]
|
39
docker-compose.yml
Normal file
39
docker-compose.yml
Normal file
|
@ -0,0 +1,39 @@
|
|||
version: '3.9'
|
||||
|
||||
services:
|
||||
mysql:
|
||||
image: mysql:8
|
||||
command: --default-authentication-plugin=mysql_native_password --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
|
||||
restart: always
|
||||
volumes:
|
||||
- ./data/mysql/:/var/lib/mysql/
|
||||
# ports:
|
||||
# - "3306:3306"
|
||||
environment:
|
||||
TZ: Asia/Shanghai # 指定时区
|
||||
MYSQL_ROOT_PASSWORD: "123456" # 配置root用户密码
|
||||
MYSQL_DATABASE: "chatgpt" # 业务库名
|
||||
MYSQL_USER: "chatgpt" # 业务库用户名
|
||||
MYSQL_PASSWORD: "chatgpt" # 业务库密码
|
||||
|
||||
redis:
|
||||
image: redis
|
||||
# command: --requirepass "12345678" # redis库密码,不需要密码注释本行
|
||||
restart: always
|
||||
# ports:
|
||||
# - "6379:6379"
|
||||
environment:
|
||||
TZ: Asia/Shanghai # 指定时区
|
||||
volumes:
|
||||
- ./data/redis/:/data/
|
||||
|
||||
nineai-open:
|
||||
build: ./
|
||||
container_name: nineai-open
|
||||
restart: always
|
||||
ports:
|
||||
- "9520:9520"
|
||||
volumes:
|
||||
- ./.env:/app/.env
|
||||
environment:
|
||||
- TZ=Asia/Shanghai
|
Loading…
Reference in New Issue
Block a user