dev: keep db/redis data on db.down

This commit is contained in:
naskya 2024-03-31 12:13:55 +09:00
parent d9ee4737bc
commit 9b354790c3
No known key found for this signature in database
GPG key ID: 712D413B3A9FED5C
3 changed files with 16 additions and 5 deletions

View file

@ -27,13 +27,13 @@ build:
pnpm run migrate
.PHONY: db.init db.up db.down
db.init:
$(MAKE) -C ./dev/db-container init
.PHONY: db.up db.down db.init
db.up:
$(MAKE) -C ./dev/db-container up
db.down:
$(MAKE) -C ./dev/db-container down
db.init:
$(MAKE) -C ./dev/db-container init
.PHONY: psql redis-cli
psql:

View file

@ -1,9 +1,11 @@
.PHONY: init up down
init: down up
.PHONY: up down init
up:
$(COMPOSE) up --detach
down:
$(COMPOSE) down
init:
$(COMPOSE) down --volumes
$(COMPOSE) up --detach
.PHONY: psql redis-cli
psql:

View file

@ -5,6 +5,8 @@ services:
image: docker.io/redis:7-alpine
ports:
- "26379:6379"
volumes:
- "redis-data:/data"
db:
image: docker.io/groonga/pgroonga:3.1.8-alpine-12
env_file:
@ -13,3 +15,10 @@ services:
- "25432:5432"
volumes:
- "./install.sql:/docker-entrypoint-initdb.d/install.sql:ro"
- "postgres-data:/var/lib/postgresql/data"
volumes:
redis-data:
name: redis-data
postgres-data:
name: postgres-data