|
| 1 | +version: '3.8' |
| 2 | +services: |
| 3 | + app: |
| 4 | + image: abdulwaisa/booklibraryapi:latest |
| 5 | + container_name: booklibraryapi_app |
| 6 | + environment: |
| 7 | + - ASPNETCORE_ENVIRONMENT=Production |
| 8 | + - ConnectionStrings__LibraryDbConnection=Host=book-lib-postgres;Port=5432;Database=librarydb;Username=postgres;Password=postgres |
| 9 | + - ConnectionStrings__Redis=book-lib-redis:6379 |
| 10 | + - Email__SmtpHost=mailpit |
| 11 | + - Email__SmtpPort=1025 |
| 12 | + - Email__From=admin@example.com |
| 13 | + - ASPNETCORE_URLS=https://+:9443;http://+:8080 |
| 14 | + - ASPNETCORE_Kestrel__Certificates__Default__Password=Password123! |
| 15 | + - ASPNETCORE_Kestrel__Certificates__Default__Path=/https/aspnet-dev-cert.pfx |
| 16 | + ports: |
| 17 | + - "8080:8080" |
| 18 | + - "9443:9443" |
| 19 | + depends_on: |
| 20 | + - book-lib-postgres |
| 21 | + - book-lib-redis |
| 22 | + - mailpit |
| 23 | + restart: unless-stopped |
| 24 | + # If you need the dev certificate, mount it as a volume: |
| 25 | + # volumes: |
| 26 | + # - ./aspnet-dev-cert.pfx:/https/aspnet-dev-cert.pfx |
| 27 | + |
| 28 | + book-lib-postgres: |
| 29 | + image: postgres:15.1 |
| 30 | + container_name: BookLibrary.Postgres |
| 31 | + environment: |
| 32 | + POSTGRES_DB: librarydb |
| 33 | + POSTGRES_USER: postgres |
| 34 | + POSTGRES_PASSWORD: postgres |
| 35 | + ports: |
| 36 | + - "5432:5432" |
| 37 | + healthcheck: |
| 38 | + test: ["CMD-SHELL", "pg_isready -U postgres"] |
| 39 | + interval: 10s |
| 40 | + timeout: 5s |
| 41 | + retries: 5 |
| 42 | + restart: unless-stopped |
| 43 | + |
| 44 | + book-lib-redis: |
| 45 | + image: redis:7.0 |
| 46 | + container_name: BookLibrary.Redis |
| 47 | + ports: |
| 48 | + - "6379:6379" |
| 49 | + healthcheck: |
| 50 | + test: ["CMD", "redis-cli", "ping"] |
| 51 | + interval: 10s |
| 52 | + timeout: 5s |
| 53 | + retries: 5 |
| 54 | + restart: unless-stopped |
| 55 | + |
| 56 | + mailpit: |
| 57 | + image: axllent/mailpit:latest |
| 58 | + container_name: mailpit |
| 59 | + ports: |
| 60 | + - "8025:8025" # Web UI |
| 61 | + - "3025:1025" # SMTP (host:container) |
| 62 | + restart: unless-stopped |
0 commit comments