Files
My-KOPKB/be/docker/production/docker-compose.production.yml
ISMAIL MASSERAN 1611656ad6
Build Docker Image / build-backend (push) Successful in 30s
Build Docker Image / build-frontend (push) Successful in 7s
DONE: fix postgres volume mounting
2026-06-30 14:36:04 +08:00

124 lines
3.1 KiB
YAML

services:
backend:
image: git.koppkb.com/kopkb/my-kopkb-be:${IMAGE_TAG:-latest}
container_name: mykopkb-be-production
restart: unless-stopped
ports:
- "${API_PORT:-8080}:80"
environment:
- APP_ENV=production
- APP_DEBUG=true
- REDIS_HOST=redis
- REDIS_PASSWORD=${REDIS_PASSWORD}
- CACHE_DRIVER=redis
- SESSION_DRIVER=redis
- QUEUE_CONNECTION=redis
volumes:
- app-storage-production:/var/www/storage
- app-logs-production:/var/www/storage/logs
- ./.env:/var/www/.env:ro
- ${NGINX_CONF:-./be/docker/production/nginx/nginx.conf}:/etc/nginx/nginx.conf:ro
networks:
- mykopkb-production-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"
frontend:
image: git.koppkb.com/kopkb/my-kopkb-fe:${IMAGE_TAG:-latest}
container_name: mykopkb-fe-production
restart: unless-stopped
ports:
- "${FE_PORT:-8081}:80"
networks:
- mykopkb-production-network
healthcheck:
test: ["CMD", "wget", "-q", "--spider", "http://127.0.0.1/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
db:
image: postgres:17
container_name: mykopkb-postgres-production
restart: unless-stopped
ports:
- "${DB_PORT:-5433}:5432"
environment:
- POSTGRES_USER=${DB_USERNAME}
- POSTGRES_PASSWORD=${DB_PASSWORD}
- POSTGRES_DB=${DB_DATABASE}
volumes:
- db-data-production:/var/lib/postgresql/data
- ./be/docker/postgres/conf.d:/etc/postgres/conf.d:ro
networks:
- mykopkb-production-network
healthcheck:
test:
[
"CMD-SHELL",
'pg_isready -U "$$POSTGRES_USER" -d "$$POSTGRES_DB" || exit 1',
]
interval: 15s
timeout: 10s
retries: 5
start_period: 30s
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
redis:
image: redis:8
container_name: mykopkb-redis-production
restart: unless-stopped
volumes:
- redis-data-production:/data
- ./redis-config/redis.conf:/usr/local/etc/redis/redis.conf:ro
command: redis-server /usr/local/etc/redis/redis.conf
networks:
- mykopkb-production-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"
networks:
mykopkb-production-network:
driver: bridge
volumes:
app-storage-production:
driver: local
app-logs-production:
driver: local
db-data-production:
driver: local
redis-data-production:
driver: local