- 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
50 lines
1.1 KiB
YAML
50 lines
1.1 KiB
YAML
# Development docker-compose: Only infrastructure services (PostgreSQL and Consul)
|
|
# Use this for local development when running services directly with `go run`
|
|
|
|
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:latest
|
|
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
|
|
|
|
volumes:
|
|
postgres_data:
|
|
driver: local
|
|
consul_data:
|
|
driver: local
|
|
|
|
networks:
|
|
goplt-network:
|
|
driver: bridge
|
|
|