1
0
mirror of https://github.com/ebosas/microservices.git synced 2024-11-16 10:08:29 +02:00
microservices/docker-compose.yml
2021-10-10 18:49:39 +03:00

84 lines
2.2 KiB
YAML

services:
rabbitmq:
image: "rabbitmq:3-management-alpine"
ports:
- 5672:5672
- 15672:15672
healthcheck:
# Rabbit health check info https://www.rabbitmq.com/monitoring.html#health-checks
test: ["CMD", "rabbitmq-diagnostics", "-q", "status"]
# test: ["CMD", "rabbitmqctl", "status"] # alternative
interval: 10s
timeout: 10s
retries: 5
postgres:
image: "postgres:13-alpine"
environment:
- POSTGRES_PASSWORD
ports:
- 5432:5432
volumes:
- ./init/database.sql:/docker-entrypoint-initdb.d/database.sql
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 10s
retries: 5
redis:
image: "redis:6-alpine"
ports:
- 6379:6379
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 10s
retries: 5
server:
build:
context: .
dockerfile: server.Dockerfile
ports:
- 8080:8080
env_file:
- .env
# restart: on-failure
depends_on:
rabbitmq:
condition: service_healthy
backend:
container_name: microservices_backend
build:
context: .
dockerfile: backend.Dockerfile
env_file:
- .env
stdin_open: true
tty: true
depends_on:
rabbitmq:
condition: service_healthy
database:
build:
context: .
dockerfile: database.Dockerfile
env_file:
- .env
depends_on:
rabbitmq:
condition: service_healthy
postgres:
condition: service_healthy
cache:
build:
context: .
dockerfile: cache.Dockerfile
env_file:
- .env
depends_on:
rabbitmq:
condition: service_healthy
redis:
condition: service_healthy
networks:
default:
name: microservices_network