Files
mykopkb-be/docker/staging/docker-compose.staging.yml
T
ismailmasseran 337be0f332
Build Docker Image / build-backend (push) Successful in 1m18s
DONE: separate repo for be and fe, update cicd
2026-10-25 11:59:58 +08:00

118 lines
3.1 KiB
YAML

services:
app:
build:
context: .
dockerfile: ./docker/common/unified/Dockerfile
args:
ENV: staging
platforms:
- linux/amd64
- linux/arm64
image: sutera-app-staging:latest
container_name: sutera-app-staging
restart: unless-stopped
ports:
- "${APP_PORT:-80}:80"
- "${HTTPS_PORT:-443}:443"
environment:
- APP_ENV=staging
- APP_DEBUG=true
- DB_HOST=postgres
- DB_PORT=${DB_PORT:-5432}
- DB_DATABASE=${DB_DATABASE}
- DB_USERNAME=${DB_USERNAME}
- DB_PASSWORD=${DB_PASSWORD}
- REDIS_HOST=redis
- REDIS_PASSWORD=${REDIS_PASSWORD}
- CACHE_DRIVER=redis
- SESSION_DRIVER=redis
- QUEUE_CONNECTION=redis
volumes:
- app-storage-staging:/var/www/storage
- app-logs-staging:/var/www/storage/logs
- /etc/letsencrypt/live/sutera.koppkb.com/fullchain.pem:/etc/nginx/ssl/fullchain.pem:ro
- /etc/letsencrypt/live/sutera.koppkb.com/privkey.pem:/etc/nginx/ssl/privkey.pem:ro
networks:
- sutera-staging-network
depends_on:
redis:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
# Redis for caching and sessions
redis:
image: redis:8.2-alpine
container_name: sutera-redis-staging
restart: unless-stopped
volumes:
- redis-data-staging:/data
- ./redis-config/redis.conf:/usr/local/etc/redis/redis.conf:ro
command: redis-server /usr/local/etc/redis/redis.conf
networks:
- sutera-staging-network
healthcheck:
test: ["CMD", "redis-cli", "-a", "${REDIS_PASSWORD}", "ping"]
interval: 10s
timeout: 5s
retries: 3
start_period: 10s
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
# Optional: Database (only if you want to run DB on same server for staging)
# Uncomment if you want to run MySQL on the same server for staging
postgres:
image: postgres:17
container_name: sutera-postgres-staging
restart: unless-stopped
ports:
- "${DB_PORT:-5432}:5432"
environment:
- POSTGRES_ROOT_PASSWORD=${DB_ROOT_PASSWORD}
- POSTGRES_DATABASE=${DB_DATABASE}
- POSTGRES_USER=${DB_USERNAME}
- POSTGRES_PASSWORD=${DB_PASSWORD}
volumes:
- postgres-data-staging:/var/lib/postgres
- ./docker/postgres/conf.d:/etc/postgres/conf.d:ro
networks:
- sutera-staging-network
healthcheck:
test: ["CMD", "postgres", "ping", "-h", "localhost"]
interval: 15s
timeout: 10s
retries: 5
start_period: 30s
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
networks:
sutera-staging-network:
driver: bridge
volumes:
app-storage-staging:
driver: local
app-logs-staging:
driver: local
redis-data-staging:
driver: local
postgres-data-staging:
driver: local