Skip to content

Edit docker-compose file #111

@moslehazizi

Description

@moslehazizi

Thanks for this great class.

About lecture #25 (create docker-compose file), It is no longer used wait_for.sh for make order between services. and it isn't in docker document. It can implemented by condition and healthcheck simply. like below:

    `version: '3.9'
    services:
      postgres:
        image: postgres:14-alpine
        environment:
          - POSTGRES_USER=root
          - POSTGRES_PASSWORD=secret
          - POSTGRES_DB=simple_bank
        ports:
          - "5432:5432"
        volumes:
          - data-volume:/var/lib/postgresql/data
        healthcheck:
          test: "exit 0"
      redis:
        image: redis:7-alpine
      api:
        build:
          context: .
          dockerfile: Dockerfile
        ports:
          - "8080:8080"
          - "9090:9090"
        environment:
          - DB_SOURCE=postgresql://root:secret@postgres:5432/simple_bank?sslmode=disable
          - REDIS_ADDRESS=redis:6379
        depends_on:
          - postgres:
            condition: service_healthy
          - redis
    volumes:
      data-volume:`

Thanks again for this wonderful class.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions