From 2733016b78b6ba47641d810990614638eceeb8e7 Mon Sep 17 00:00:00 2001 From: Ricardo Arturo Cabral Mejia Date: Wed, 12 Oct 2022 01:19:44 +0000 Subject: [PATCH] feat: add docker-compose.yml --- docker-compose.yml | 63 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 docker-compose.yml diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..851f93e --- /dev/null +++ b/docker-compose.yml @@ -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: