# Test stack for PHPUnit and Playwright, locally and in CI. # npm run test:unit:docker / npm run test:e2e:docker name: pl_mail_test x-test-app: &test-app build: context: . target: frankenphp_dev image: pl_mail_test-app volumes: - ./:/app - app_var_test:/app/var - app_public_assets_test:/app/public/assets environment: &test-env APP_ENV: test APP_DEBUG: "1" APP_SECRET: 282065e0f71bf96c0dbcf0496c1f5d3e APP_ENCRYPTION_KEY: emL6R8zs0pSXCVV2HvVvbFubriWJIla7kgnqSGqCJ8E= DATABASE_URL: postgresql://app:app@database:5432/app?serverVersion=18&charset=utf8 MESSENGER_TRANSPORT_DSN: in-memory:// MESSENGER_BULK_DSN: doctrine://default?auto_setup=0 MAILER_DSN: null://null APP_DEV_USER_EMAIL: e2e@plmail.test APP_DEV_USER_PASSWORD: e2e-password-change-me MERCURE_PUBLIC_URL: http://127.0.0.1:${TEST_HTTP_PORT:-8001}/.well-known/mercure MERCURE_COOKIE_NAME: mercure_access_token MERCURE_URL: http://mercure/.well-known/mercure MERCURE_JWT_SECRET: e2e-mercure-secret-not-for-production depends_on: database: condition: service_healthy services: database: image: postgres:18-alpine environment: POSTGRES_DB: app POSTGRES_USER: app POSTGRES_PASSWORD: app healthcheck: test: ["CMD", "pg_isready", "-d", "app", "-U", "app"] interval: 5s timeout: 5s retries: 10 volumes: - database_data_test:/var/lib/postgresql app-init: <<: *test-app entrypoint: ["docker-php-entrypoint"] restart: "no" command: - sh - -c - | set -e [ -f vendor/autoload_runtime.php ] || composer install --prefer-dist --no-progress --no-interaction php bin/console doctrine:database:create --if-not-exists php bin/console app:db:migrate --no-interaction php bin/console importmap:install php bin/console tailwind:build \ || { sleep 5; php bin/console tailwind:build; } \ || { sleep 20; php bin/console tailwind:build; } php bin/console asset-map:compile php bin/console app:test:seed-user php bin/console app:test:seed-user --admin --email=e2e-admin@plmail.test --password=e2e-admin-password mercure: image: dunglas/mercure environment: SERVER_NAME: ":80" MERCURE_PUBLISHER_JWT_KEY: e2e-mercure-secret-not-for-production MERCURE_SUBSCRIBER_JWT_KEY: e2e-mercure-secret-not-for-production MERCURE_TRUSTED_ISSUERS: https://plmail.invalid/.well-known/mercure MERCURE_EXTRA_DIRECTIVES: | resource_identifier https://plmail.invalid/.well-known/mercure cookie_name mercure_access_token app: <<: *test-app environment: <<: *test-env SERVER_NAME: ":80" ports: - "${TEST_HTTP_PORT:-8001}:80" depends_on: database: condition: service_healthy app-init: condition: service_completed_successfully mercure: condition: service_healthy worker-bulk: <<: *test-app command: php bin/console messenger:consume bulk --time-limit=600 --memory-limit=256M -vv restart: unless-stopped stop_grace_period: 5s healthcheck: test: - CMD-SHELL - grep -lza 'messenger:[c]onsume' /proc/*/cmdline > /dev/null 2>&1 interval: 5s timeout: 3s retries: 6 start_period: 5s depends_on: database: condition: service_healthy app-init: condition: service_completed_successfully volumes: app_var_test: app_public_assets_test: database_data_test: