implement db-seed

This commit is contained in:
MaKarin
2026-04-04 10:04:47 +03:00
parent 3bc23165a3
commit 1a8fd94858
2 changed files with 116 additions and 0 deletions

View File

@@ -56,6 +56,28 @@ services:
- toir-light
- proxy
db-seed:
image: postgres:16
container_name: toir-light-db-seed
restart: "no"
depends_on:
postgres:
condition: service_healthy
environment:
PGPASSWORD: ${POSTGRES_PASSWORD:-change-me}
POSTGRES_USER: ${POSTGRES_USER:-postgres}
POSTGRES_DB: ${POSTGRES_DB:-toir}
volumes:
- ./equipment-import.sql:/seed/equipment-import.sql:ro
command:
[
"sh",
"-c",
"psql -h postgres -U \"$${POSTGRES_USER}\" -d \"$${POSTGRES_DB}\" -v ON_ERROR_STOP=1 -f /seed/equipment-import.sql",
]
networks:
- toir-light
client:
build:
context: ./client
@@ -70,6 +92,8 @@ services:
depends_on:
server:
condition: service_healthy
db-seed:
condition: service_completed_successfully
healthcheck:
test: ["CMD-SHELL", "wget -qO- http://127.0.0.1/healthz >/dev/null 2>&1 || exit 1"]
interval: 15s