From cba2096adfcfbd25120880ce08cd5552c7977ef9 Mon Sep 17 00:00:00 2001 From: 0x1d Date: Thu, 6 Nov 2025 21:02:54 +0100 Subject: [PATCH] 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 --- docker-compose.yml | 28 +++++++++++++++++++++++++++ docs/content/stories/epic2/SUMMARY.md | 9 +++++++-- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index cac577d..b58c736 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -121,6 +121,34 @@ services: - 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 diff --git a/docs/content/stories/epic2/SUMMARY.md b/docs/content/stories/epic2/SUMMARY.md index 27b5e2c..7013702 100644 --- a/docs/content/stories/epic2/SUMMARY.md +++ b/docs/content/stories/epic2/SUMMARY.md @@ -230,6 +230,7 @@ This will start: - Identity Service (port 8082) - Authz Service (port 8083) - Audit Service (port 8084) +- API Gateway (port 8080) ### Infrastructure Services @@ -423,9 +424,12 @@ goplt/ │ │ ├── main.go │ │ ├── authz_service_fx.go │ │ └── Dockerfile -│ └── audit-service/ +│ ├── audit-service/ +│ │ ├── main.go +│ │ ├── audit_service_fx.go +│ │ └── Dockerfile +│ └── api-gateway/ │ ├── main.go -│ ├── audit_service_fx.go │ └── Dockerfile ├── docker-compose.yml ├── docker-compose.dev.yml @@ -473,6 +477,7 @@ docker build -f cmd/auth-service/Dockerfile -t goplt-auth-service:latest . docker build -f cmd/identity-service/Dockerfile -t goplt-identity-service:latest . docker build -f cmd/authz-service/Dockerfile -t goplt-authz-service:latest . docker build -f cmd/audit-service/Dockerfile -t goplt-audit-service:latest . +docker build -f cmd/api-gateway/Dockerfile -t goplt-api-gateway:latest . ``` ### Docker Compose Files