simplebank
simplebank copied to clipboard
Edit docker-compose file
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.