Browse Source

增加部署配置

theme
npmrun 2 years ago
parent
commit
94624cbb3b
  1. 6
      .env.development
  2. 6
      .env.production
  3. 2
      Dockerfile
  4. 18
      docker-compose.yml
  5. 1
      package.json

6
.env.development

@ -1,3 +1,9 @@
NODE_ENV=development
# https://www.bookstack.cn/read/hapijs-zh/2f6997ac6d3fb529.md
KEY = dsRhw1Y5UZqB8SjfClbkrX9PF7yuDMV3JItcW0G4vgpaxONo6mzenHLQET2AiKyPUjjdDko10amjPaba
# SQLITE_PATH=/usr/src/app/data/data.db
MYSQL_HOST=localhost
MYSQL_PORT=3306
MYSQL_USER=myuser
MYSQL_PASSWORD=mypassword
MYSQL_DATABASE=mydatabase

6
.env.production

@ -1,3 +1,9 @@
NODE_ENV=production
# https://www.bookstack.cn/read/hapijs-zh/2f6997ac6d3fb529.md
KEY = dsRhw1Y5UZqB8SjfClbkrX9PF7yuDMV3JItcW0G4vgpaxONo6mzenHLQET2AiKyPUjjdDko10amjPaba
# SQLITE_PATH=/usr/src/app/data/data.db
MYSQL_HOST=localhost
MYSQL_PORT=3306
MYSQL_USER=myuser
MYSQL_PASSWORD=mypassword
MYSQL_DATABASE=mydatabase

2
Dockerfile

@ -18,4 +18,4 @@ RUN pnpm install
EXPOSE 3388
CMD [ "pnpm", "start" ]
CMD [ "pnpm", "start:docker" ]

18
docker-compose.yml

@ -0,0 +1,18 @@
version: '3'
services:
app:
build: .
ports:
- "3388:3388"
environment:
NODE_ENV: production
SQLITE_PATH: /usr/src/app/data/data.db
KEY: dsRhw1Y5UZqB8SjfClbkrX9PF7yuDMV3JItcW0G4vgpaxONo6mzenHLQET2AiKyPUjjdDko10amjPaba
MYSQL_HOST: localhost
MYSQL_PORT: 3306
MYSQL_USER: myuser
MYSQL_PASSWORD: mypassword
MYSQL_DATABASE: mydatabase
volumes:
- ./logs:/usr/src/app/logs
- ./data:/usr/src/app/data

1
package.json

@ -9,6 +9,7 @@
"init": "ts-node --respawn --project ./tsconfig.json -r tsconfig-paths/register source/db/init.ts alter",
"zip": "node script/zip.js",
"build": "tsc && tsc-alias",
"start:docker": "node dist/main.js",
"start": "node -r dotenv/config dist/main.js dotenv_config_path=.env.production",
"dev": "tsx watch -r tsconfig-paths/register -r dotenv/config ./source/main.ts dotenv_config_path=.env.development",
"devb": "ts-node-dev --watch ./source/route --ignore-watch ./source/route/route.txt --respawn --project ./tsconfig.json -r tsconfig-paths/register -r dotenv/config ./source/main.ts dotenv_config_path=.env.development",

Loading…
Cancel
Save