simplebank icon indicating copy to clipboard operation
simplebank copied to clipboard

Edit docker-compose file

Open moslehazizi opened this issue 2 years ago • 0 comments

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.

moslehazizi avatar Dec 19 '23 15:12 moslehazizi