services: app: container_name: app build: context: . dockerfile: Dockerfile image: go-app ports: - 8080:8080 env_file: - .env environment: # Overriding the env_file values POSTGRES_URI: postgres://postgres:password@postgres:5432/mydb?sslmode=disable REDIS_URI: redis:6379 healthcheck: test: ["CMD", "curl", "-f", "http://localhost:8080/health"] interval: 10s timeout: 5s retries: 5 depends_on: postgres: condition: service_healthy redis: condition: service_healthy networks: - go-network develop: watch: - path: . action: rebuild postgres: container_name: postgres image: postgres:17.2 ports: - 5432:5432 environment: POSTGRES_USER: postgres POSTGRES_PASSWORD: password POSTGRES_DB: mydb healthcheck: test: ["CMD", "pg_isready", "-U", "postgres"] interval: 10s timeout: 5s retries: 5 volumes: - postgres_data:/var/lib/postgresql/data networks: - go-network redis: container_name: redis image: redis:7.4 volumes: - redisdata:/data ports: - 6379:6379 healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 10s timeout: 10s retries: 5 start_period: 40s networks: - go-network volumes: postgres_data: redisdata: networks: go-network: driver: bridge