Skip to content

Instantly share code, notes, and snippets.

@hoangsetup
Created March 26, 2022 13:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hoangsetup/695b807b68a90ccc16c18c64db6226db to your computer and use it in GitHub Desktop.
Save hoangsetup/695b807b68a90ccc16c18c64db6226db to your computer and use it in GitHub Desktop.
diff --git a/docker-compose.yml b/docker-compose.yml
index 94302ff..19dff7a 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,7 +1,7 @@
version: '3.9'
services:
api:
- build: .
+ build: node:latest
working_dir: /api
volumes:
- .:/api
@@ -11,8 +11,38 @@ services:
depends_on:
compile:
condition: service_healthy
+ rabbitmq:
+ condition: service_healthy
+ redis:
+ condition: service_healthy
environment:
- API_PORT=${API_PORT}
+ - RABBITMQ_HOST=${RABBITMQ_HOST}
+ - RABBITMQ_PORT=${RABBITMQ_PORT}
+ - RABBITMQ_USERNAME=${RABBITMQ_USERNAME}
+ - RABBITMQ_PASSWORD=${RABBITMQ_PASSWORD}
+ - RABBITMQ_QUEUE=${RABBITMQ_QUEUE}
+ - REDIS_URL=${REDIS_URL}
+ consumer:
+ build: .
+ working_dir: /consumer
+ volumes:
+ - .:/consumer
+ command: npm run dev:consumer
+ scale: 1
+ depends_on:
+ compile:
+ condition: service_healthy
+ rabbitmq:
+ condition: service_healthy
+ redis:
+ condition: service_healthy
+ environment:
+ - RABBITMQ_HOST=${RABBITMQ_HOST}
+ - RABBITMQ_PORT=${RABBITMQ_PORT}
+ - RABBITMQ_USERNAME=${RABBITMQ_USERNAME}
+ - RABBITMQ_PASSWORD=${RABBITMQ_PASSWORD}
+ - RABBITMQ_QUEUE=${RABBITMQ_QUEUE}
compile:
image: node:latest
working_dir: /source
@@ -24,3 +54,16 @@ services:
interval: 10s
timeout: 5s
retries: 5
+ rabbitmq:
+ image: bitnami/rabbitmq:latest
+ environment:
+ - RABBITMQ_USERNAME=${RABBITMQ_USERNAME}
+ - RABBITMQ_PASSWORD=${RABBITMQ_PASSWORD}
+ healthcheck:
+ test: rabbitmq-diagnostics -q check_running
+ ports:
+ - '${RABBITMQ_ADMIN_WEB_PORT}:${RABBITMQ_ADMIN_WEB_PORT}'
+ redis:
+ image: redis:latest
+ healthcheck:
+ test: redis-cli ping
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment