Add tooling to test production Docker images locally before CI/CD: - docker-compose.prod-test.yml: Local production test environment - TESTING_PRODUCTION_LOCALLY.md: Comprehensive testing guide - Makefile: Added prod-test-* commands for easy testing New Make commands: - make prod-test - Build and run production image - make prod-test-build - Build with no cache - make prod-test-up - Start in background - make prod-test-logs - View logs - make prod-test-shell - Debug in container - make prod-test-status - Check supervisor status - make prod-test-clean - Fresh start Benefits: - 5-10min faster feedback vs CI/CD builds - Easier debugging with direct container access - Catch Docker/config issues before pushing - Test supervisor, nginx, php-fpm, queue workers locally Usage: make prod-test 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
76 lines
1.9 KiB
YAML
76 lines
1.9 KiB
YAML
# Docker Compose for testing production image locally
|
|
# Usage: docker-compose -f docker-compose.prod-test.yml up --build
|
|
version: '3.8'
|
|
|
|
services:
|
|
# PostgreSQL database for local testing
|
|
postgres:
|
|
image: postgres:17
|
|
environment:
|
|
POSTGRES_DB: cannabrands_test
|
|
POSTGRES_USER: cannabrands_test
|
|
POSTGRES_PASSWORD: test_password
|
|
ports:
|
|
- "5433:5432" # Different port to avoid conflicts with Sail
|
|
volumes:
|
|
- postgres_test_data:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U cannabrands_test"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
# Your production Laravel app
|
|
app:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
args:
|
|
GIT_COMMIT_SHA: local-test
|
|
APP_VERSION: local
|
|
ports:
|
|
- "8080:80" # Map to 8080 to avoid conflicts with Sail
|
|
environment:
|
|
# Application
|
|
APP_NAME: "Cannabrands CRM (Test)"
|
|
APP_ENV: local
|
|
APP_DEBUG: "true"
|
|
APP_KEY: "base64:zYloN4cn3qDHbL6h2VrP32M7+/D582YVrtMT25DR+ik=" # Test key
|
|
APP_URL: http://localhost:8080
|
|
|
|
# Database
|
|
DB_CONNECTION: pgsql
|
|
DB_HOST: postgres
|
|
DB_PORT: 5432
|
|
DB_DATABASE: cannabrands_test
|
|
DB_USERNAME: cannabrands_test
|
|
DB_PASSWORD: test_password
|
|
|
|
# Cache & Sessions
|
|
CACHE_DRIVER: file
|
|
SESSION_DRIVER: database
|
|
QUEUE_CONNECTION: database
|
|
VIEW_COMPILED_PATH: /var/www/html/storage/framework/views
|
|
|
|
# Mail (use log driver for testing)
|
|
MAIL_MAILER: log
|
|
MAIL_FROM_ADDRESS: test@cannabrands.local
|
|
MAIL_FROM_NAME: "Cannabrands CRM Test"
|
|
|
|
# Logging
|
|
LOG_CHANNEL: stack
|
|
LOG_LEVEL: debug
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:80/"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 3
|
|
start_period: 30s
|
|
|
|
volumes:
|
|
postgres_test_data:
|
|
driver: local
|