Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edit docker-compose file #111

Open
moslehazizi opened this issue Dec 19, 2023 · 0 comments
Open

Edit docker-compose file #111

moslehazizi opened this issue Dec 19, 2023 · 0 comments

Comments

@moslehazizi
Copy link

moslehazizi commented Dec 19, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant