2025-07-18 20:10:29 +07:00
|
|
|
version: '3.8'
|
|
|
|
|
|
2023-10-08 15:59:42 +07:00
|
|
|
services:
|
2025-07-18 20:10:29 +07:00
|
|
|
# PostgreSQL Database
|
|
|
|
|
postgres:
|
|
|
|
|
image: postgres:15-alpine
|
|
|
|
|
container_name: apskel-pos-postgres
|
|
|
|
|
restart: unless-stopped
|
|
|
|
|
environment:
|
|
|
|
|
POSTGRES_DB: apskel_pos
|
|
|
|
|
POSTGRES_USER: apskel
|
|
|
|
|
POSTGRES_PASSWORD: 7a8UJbM2GgBWaseh0lnP3O5i1i5nINXk
|
|
|
|
|
POSTGRES_INITDB_ARGS: "--encoding=UTF-8"
|
|
|
|
|
volumes:
|
|
|
|
|
- postgres_data:/var/lib/postgresql/data
|
|
|
|
|
- ./init.sql:/docker-entrypoint-initdb.d/init.sql
|
|
|
|
|
ports:
|
|
|
|
|
- "5432:5432"
|
|
|
|
|
networks:
|
|
|
|
|
- apskel-network
|
|
|
|
|
healthcheck:
|
|
|
|
|
test: ["CMD-SHELL", "pg_isready -U apskel -d apskel_pos"]
|
|
|
|
|
interval: 30s
|
|
|
|
|
timeout: 10s
|
|
|
|
|
retries: 3
|
|
|
|
|
|
|
|
|
|
# Redis (Optional - for caching and sessions)
|
|
|
|
|
redis:
|
|
|
|
|
image: redis:7-alpine
|
|
|
|
|
container_name: apskel-pos-redis
|
|
|
|
|
restart: unless-stopped
|
|
|
|
|
ports:
|
|
|
|
|
- "6379:6379"
|
|
|
|
|
volumes:
|
|
|
|
|
- redis_data:/data
|
|
|
|
|
networks:
|
|
|
|
|
- apskel-network
|
|
|
|
|
healthcheck:
|
|
|
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
|
|
|
interval: 30s
|
|
|
|
|
timeout: 10s
|
|
|
|
|
retries: 3
|
|
|
|
|
|
|
|
|
|
# Backend API
|
|
|
|
|
backend:
|
|
|
|
|
build:
|
|
|
|
|
context: .
|
|
|
|
|
dockerfile: Dockerfile
|
|
|
|
|
target: production
|
|
|
|
|
container_name: apskel-pos-backend
|
|
|
|
|
restart: unless-stopped
|
|
|
|
|
environment:
|
|
|
|
|
ENV_MODE: production
|
|
|
|
|
GIN_MODE: release
|
2023-10-08 15:59:42 +07:00
|
|
|
ports:
|
2025-07-18 20:10:29 +07:00
|
|
|
- "3300:3300"
|
|
|
|
|
depends_on:
|
|
|
|
|
postgres:
|
|
|
|
|
condition: service_healthy
|
|
|
|
|
redis:
|
|
|
|
|
condition: service_healthy
|
|
|
|
|
networks:
|
|
|
|
|
- apskel-network
|
|
|
|
|
volumes:
|
|
|
|
|
- ./infra:/app/infra:ro
|
|
|
|
|
healthcheck:
|
|
|
|
|
test: ["CMD-SHELL", "curl -f http://localhost:3300/health || exit 1"]
|
|
|
|
|
interval: 30s
|
|
|
|
|
timeout: 10s
|
|
|
|
|
retries: 3
|
|
|
|
|
|
|
|
|
|
# Development backend (for local development)
|
|
|
|
|
backend-dev:
|
|
|
|
|
build:
|
|
|
|
|
context: .
|
|
|
|
|
dockerfile: Dockerfile
|
|
|
|
|
target: development
|
|
|
|
|
container_name: apskel-pos-backend-dev
|
|
|
|
|
restart: unless-stopped
|
|
|
|
|
environment:
|
|
|
|
|
ENV_MODE: development
|
|
|
|
|
GIN_MODE: debug
|
|
|
|
|
ports:
|
|
|
|
|
- "3001:3300"
|
|
|
|
|
depends_on:
|
|
|
|
|
postgres:
|
|
|
|
|
condition: service_healthy
|
|
|
|
|
networks:
|
|
|
|
|
- apskel-network
|
|
|
|
|
volumes:
|
|
|
|
|
- .:/app
|
|
|
|
|
- go_modules:/go/pkg/mod
|
|
|
|
|
profiles:
|
|
|
|
|
- dev
|
|
|
|
|
|
|
|
|
|
# Migration service (run once)
|
|
|
|
|
migrate:
|
|
|
|
|
build:
|
|
|
|
|
context: .
|
|
|
|
|
dockerfile: Dockerfile
|
|
|
|
|
target: migration
|
|
|
|
|
container_name: apskel-pos-migrate
|
|
|
|
|
environment:
|
|
|
|
|
ENV_MODE: production
|
|
|
|
|
depends_on:
|
|
|
|
|
postgres:
|
|
|
|
|
condition: service_healthy
|
|
|
|
|
networks:
|
|
|
|
|
- apskel-network
|
2023-10-08 15:59:42 +07:00
|
|
|
volumes:
|
2025-07-18 20:10:29 +07:00
|
|
|
- ./infra:/app/infra:ro
|
|
|
|
|
- ./migrations:/app/migrations:ro
|
|
|
|
|
profiles:
|
|
|
|
|
- migrate
|
|
|
|
|
|
|
|
|
|
volumes:
|
|
|
|
|
postgres_data:
|
|
|
|
|
driver: local
|
|
|
|
|
redis_data:
|
|
|
|
|
driver: local
|
|
|
|
|
go_modules:
|
|
|
|
|
driver: local
|
|
|
|
|
|
|
|
|
|
networks:
|
|
|
|
|
apskel-network:
|
|
|
|
|
driver: bridge
|