Skip to content

Commit

Permalink
Update docker-compose
Browse files Browse the repository at this point in the history
  • Loading branch information
erich2s committed Oct 29, 2024
1 parent 32682dd commit 8c0f55a
Show file tree
Hide file tree
Showing 4 changed files with 2,359 additions and 1,953 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@
pnpm dev
```

2. 将项目根目录下的`.env.``.env.development`中的环境变量配置好,尤其是`.env.development`中的`DATABASE_URL`(即你的数据库url),并启动好数据库。
2. 将项目根目录下的`.env.``.env.development`中的环境变量配置好,尤其是`.env.development`中的`DATABASE_URL`(即你的数据库url),并使用`docker compose`启动开发环境的数据库。

```bash
docker compose -f docker-compose.dev.yml up -d
```

3. 初始化并seeding数据库(将一些模拟数据和管理员账号写进数据库):

Expand Down
16 changes: 16 additions & 0 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# 开发环境的启动准备
services:
postgres:
image: postgres:15.4
restart: always
container_name: postgres_container
environment:
- POSTGRES_USER=root
- POSTGRES_PASSWORD=123456
volumes:
- mms-postgres:/var/lib/postgresql/data
ports:
- 5432:5432

volumes:
mms-postgres:
9 changes: 4 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# docker-compose.yml
version: "3.8"
# 生产环境的启动
services:
web:
# image: erich2s/maintenance-management-system:latest
Expand Down Expand Up @@ -37,10 +36,10 @@ services:
restart: always
container_name: postgres_container
environment:
- POSTGRES_USER=admin
- POSTGRES_USER=root
- POSTGRES_PASSWORD=123456
volumes:
- postgres:/var/lib/postgresql/data
- mms-postgres:/var/lib/postgresql/data

volumes:
postgres:
mms-postgres:
Loading

0 comments on commit 8c0f55a

Please sign in to comment.