feat: add docker-compose.yml

This commit is contained in:
Ricardo Arturo Cabral Mejia 2022-10-12 01:19:44 +00:00
parent d04f6b089c
commit 2733016b78
No known key found for this signature in database
GPG Key ID: 5931EBF43A650245

63
docker-compose.yml Normal file
View File

@ -0,0 +1,63 @@
services:
relay:
build: .
environment:
DB_HOST: db
DB_PORT: 5432
DB_USER: nostr-ts-relay
DB_PASSWORD: nostr-ts-relay
DB_NAME: nostr-ts-relay
NOSTR_CONFIG_DIR: /nostr
volumes:
- nostr-config:/nostr
ports:
- "8008:8008"
depends_on:
db:
condition: service_healthy
migration:
condition: service_completed_successfully
networks:
- nostr-ts-relay
restart: always
db:
image: postgres
environment:
POSTGRES_USER: nostr-ts-relay
POSTGRES_PASSWORD: nostr-ts-relay
volumes:
- postgres-data:/var/lib/postgresql/data/
networks:
- nostr-ts-relay
restart: always
healthcheck:
test: ["CMD-SHELL", "pg_isready -U nostr-ts-relay"]
interval: 5s
timeout: 5s
retries: 5
migration:
image: node:18-alpine3.15
environment:
DB_HOST: db
DB_PORT: 5432
DB_USER: nostr-ts-relay
DB_PASSWORD: nostr-ts-relay
DB_NAME: nostr-ts-relay
entrypoint:
- sh
- -c
- 'sleep 5s && cd code/ && npm install -g knex && npm run db:migrate'
restart: on-failure
volumes:
- .:/code
depends_on:
- db
networks:
- nostr-ts-relay
networks:
nostr-ts-relay:
volumes:
postgres-data:
nostr-config: