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 pnpm run migrate
.PHONY: db.init db.up db.down .PHONY: db.up db.down db.init
db.init:
$(MAKE) -C ./dev/db-container init
db.up: db.up:
$(MAKE) -C ./dev/db-container up $(MAKE) -C ./dev/db-container up
db.down: db.down:
$(MAKE) -C ./dev/db-container down $(MAKE) -C ./dev/db-container down
db.init:
$(MAKE) -C ./dev/db-container init
.PHONY: psql redis-cli .PHONY: psql redis-cli
psql: psql:

View file

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

View file

@ -5,6 +5,8 @@ services:
image: docker.io/redis:7-alpine image: docker.io/redis:7-alpine
ports: ports:
- "26379:6379" - "26379:6379"
volumes:
- "redis-data:/data"
db: db:
image: docker.io/groonga/pgroonga:3.1.8-alpine-12 image: docker.io/groonga/pgroonga:3.1.8-alpine-12
env_file: env_file:
@ -13,3 +15,10 @@ services:
- "25432:5432" - "25432:5432"
volumes: volumes:
- "./install.sql:/docker-entrypoint-initdb.d/install.sql:ro" - "./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