From 6ee659d86dc7c3507af6a6e0fa41f62df3efc870 Mon Sep 17 00:00:00 2001 From: Robinson Uchechukwu Date: Thu, 8 Aug 2024 14:57:52 +0100 Subject: [PATCH] Create docker-compose.yml --- docker-compose.yml | 75 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 docker-compose.yml diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..3d8181b4 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,75 @@ +services: + backend: + build: + context: . + args: + - NODE_ENV=${NODE_ENV} + ports: + - 2222:8000 + env_file: + - .env + environment: + DATABASE_URL: postgres:// ${DB_USER}:${DB_PASSWORD}@backend_db:5432/${DB_NAME} + networks: + - app + depends_on: + backend_db: + condition: service_healthy + restart: always + command: sh -c "sleep 10 && yarn start" + + backend_db: + image: postgres:13 + container_name: backend_db + restart: unless-stopped + env_file: + - .env + environment: + POSTGRES_USER: ${DB_USER} + POSTGRES_PASSWORD: ${DB_PASSWORD} + volumes: + - postgres-data:/var/lib/postgresql/data + #- ./init-scripts:/docker-entrypoint-initdb.d + ports: + - 5432 + healthcheck: + test: ["CMD-SHELL", "pg_isready -U postgres"] + interval: 10s + timeout: 5s + retries: 5 + networks: + - app + + # nginx: + # image: nginx:latest + # ports: + # - "80:80" + # - "443:443" + # volumes: + # - ./nginx/nginx.conf:/etc/nginx/nginx.conf + # - ./nginx/sites-available/expressjs:/etc/nginx/sites-available/expressjs + # - ./nginx/sites-enabled:/etc/nginx/sites-enabled + # - /etc/letsencrypt:/etc/letsencrypt + # - ./nginx-entrypoint.sh:/docker-entrypoint.sh + # networks: + # - app + # depends_on: + # - backend + # restart: always + + rabbitmq: + image: rabbitmq:3-management + ports: + - "5672" + # - "5672:5672" + - "15672" + # - "15672:15672" + networks: + - app + +networks: + app: + driver: bridge + +volumes: + postgres-data: