Files
goplt/docker-compose.yml
0x1d cba2096adf feat(docker): Add API Gateway to Docker Compose
- Create Dockerfile for API Gateway
  - Multi-stage build using golang:1.25-alpine
  - Minimal runtime image using alpine:latest
  - Exposes port 8080

- Add API Gateway service to docker-compose.yml
  - Depends on Consul and all core services
  - Environment variables for gateway configuration
  - Port 8080 exposed

- Update SUMMARY.md
  - Add API Gateway to service list
  - Add API Gateway to Docker build instructions
  - Update file structure to include API Gateway Dockerfile
2025-11-06 21:02:54 +01:00

161 lines
3.9 KiB
YAML

# Full docker-compose: All services + infrastructure
# Use this to run the complete platform with all services in Docker
services:
postgres:
image: postgres:16-alpine
container_name: goplt-postgres
environment:
POSTGRES_USER: goplt
POSTGRES_PASSWORD: goplt_password
POSTGRES_DB: goplt
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U goplt"]
interval: 5s
timeout: 5s
retries: 5
networks:
- goplt-network
consul:
image: consul:1.15.4
container_name: goplt-consul
command: consul agent -dev -client=0.0.0.0
ports:
- "8500:8500"
volumes:
- consul_data:/consul/data
healthcheck:
test: ["CMD-SHELL", "consul members"]
interval: 10s
timeout: 3s
retries: 5
networks:
- goplt-network
auth-service:
build:
context: .
dockerfile: cmd/auth-service/Dockerfile
container_name: goplt-auth-service
environment:
ENVIRONMENT: production
DATABASE_DSN: "postgres://goplt:goplt_password@postgres:5432/goplt?sslmode=disable"
REGISTRY_TYPE: consul
REGISTRY_CONSUL_ADDRESS: "consul:8500"
ports:
- "8081:8081"
depends_on:
postgres:
condition: service_healthy
consul:
condition: service_healthy
networks:
- goplt-network
restart: unless-stopped
identity-service:
build:
context: .
dockerfile: cmd/identity-service/Dockerfile
container_name: goplt-identity-service
environment:
ENVIRONMENT: production
DATABASE_DSN: "postgres://goplt:goplt_password@postgres:5432/goplt?sslmode=disable"
REGISTRY_TYPE: consul
REGISTRY_CONSUL_ADDRESS: "consul:8500"
ports:
- "8082:8082"
depends_on:
postgres:
condition: service_healthy
consul:
condition: service_healthy
networks:
- goplt-network
restart: unless-stopped
authz-service:
build:
context: .
dockerfile: cmd/authz-service/Dockerfile
container_name: goplt-authz-service
environment:
ENVIRONMENT: production
DATABASE_DSN: "postgres://goplt:goplt_password@postgres:5432/goplt?sslmode=disable"
REGISTRY_TYPE: consul
REGISTRY_CONSUL_ADDRESS: "consul:8500"
ports:
- "8083:8083"
depends_on:
postgres:
condition: service_healthy
consul:
condition: service_healthy
networks:
- goplt-network
restart: unless-stopped
audit-service:
build:
context: .
dockerfile: cmd/audit-service/Dockerfile
container_name: goplt-audit-service
environment:
ENVIRONMENT: production
DATABASE_DSN: "postgres://goplt:goplt_password@postgres:5432/goplt?sslmode=disable"
REGISTRY_TYPE: consul
REGISTRY_CONSUL_ADDRESS: "consul:8500"
ports:
- "8084:8084"
depends_on:
postgres:
condition: service_healthy
consul:
condition: service_healthy
networks:
- goplt-network
restart: unless-stopped
api-gateway:
build:
context: .
dockerfile: cmd/api-gateway/Dockerfile
container_name: goplt-api-gateway
environment:
ENVIRONMENT: production
REGISTRY_TYPE: consul
REGISTRY_CONSUL_ADDRESS: "consul:8500"
GATEWAY_PORT: "8080"
GATEWAY_HOST: "0.0.0.0"
ports:
- "8080:8080"
depends_on:
consul:
condition: service_healthy
auth-service:
condition: service_started
identity-service:
condition: service_started
authz-service:
condition: service_started
audit-service:
condition: service_started
networks:
- goplt-network
restart: unless-stopped
volumes:
postgres_data:
driver: local
consul_data:
driver: local
networks:
goplt-network:
driver: bridge