feat(docker): Add Docker support for all services
- Create Dockerfiles for all four services (auth, identity, authz, audit) - Multi-stage builds using golang:1.25-alpine - Minimal runtime images using alpine:latest - Copy config files to runtime image - Create docker-compose.dev.yml for development - Only PostgreSQL and Consul - Use when running services locally with 'go run' - Update docker-compose.yml for full deployment - All services + infrastructure - Services build from Dockerfiles - Health checks and dependencies configured - Environment variables for service configuration - Add .dockerignore to optimize build context - Excludes docs, tests, IDE files, build artifacts - Update SUMMARY.md - Document both docker-compose files - Add Docker deployment section - Update file structure to include Dockerfiles
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
# Full docker-compose: All services + infrastructure
|
||||
# Use this to run the complete platform with all services in Docker
|
||||
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:16-alpine
|
||||
@@ -34,6 +37,90 @@ services:
|
||||
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
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
driver: local
|
||||
@@ -43,4 +130,3 @@ volumes:
|
||||
networks:
|
||||
goplt-network:
|
||||
driver: bridge
|
||||
|
||||
|
||||
Reference in New Issue
Block a user