Files
ppr-ng/docker-compose.e2e.yml
2026-06-22 05:58:26 -04:00

81 lines
2.2 KiB
YAML

services:
db:
container_name: ppr_e2e_db
build:
context: .
dockerfile: tests/e2e/mysql.Dockerfile
image: pprdev-e2e-db
environment:
MYSQL_ROOT_PASSWORD: e2e_root_password
MYSQL_DATABASE: ppr_e2e
MYSQL_USER: ppr_e2e
MYSQL_PASSWORD: ppr_e2e_password
volumes:
- ppr_e2e_mysql_data:/var/lib/mysql
api:
container_name: ppr_e2e_api
ports:
- "${E2E_API_PORT_EXTERNAL:-18002}:8000"
environment:
DB_HOST: db
DB_PORT: 3306
DB_NAME: ppr_e2e
DB_USER: ppr_e2e
DB_PASSWORD: ppr_e2e_password
BASE_URL: http://web
MAIL_HOST: 127.0.0.1
MAIL_PORT: 1
MAIL_USERNAME: e2e
MAIL_PASSWORD: e2e
MAIL_FROM: e2e@example.com
MAIL_FROM_NAME: PPR E2E
DRONE_REQUEST_TOWER_EMAIL: tower@example.com
web:
container_name: ppr_e2e_web
ports:
- "${E2E_WEB_PORT_EXTERNAL:-18055}:80"
environment:
BASE_URL: ""
command: >
sh -c "if [ -z \"$${BASE_URL}\" ]; then API_BASE='/api/v1'; else API_BASE=\"$${BASE_URL}/api/v1\"; fi;
printf 'window.PPR_CONFIG = { apiBase: \"%s\" };' \"$${API_BASE}\" > /usr/share/nginx/html/config.js;
nginx -g 'daemon off;'"
e2e:
build:
context: .
dockerfile: tests/e2e/Dockerfile
working_dir: /workspace
volumes:
- .:/workspace
environment:
E2E_BASE_URL: http://web
E2E_ADMIN_USERNAME: ${E2E_ADMIN_USERNAME:-}
E2E_ADMIN_PASSWORD: ${E2E_ADMIN_PASSWORD:-}
E2E_HEALTH_URL: http://api:8000/health
E2E_ARTIFACT_UID: ${E2E_ARTIFACT_UID:-1000}
E2E_ARTIFACT_GID: ${E2E_ARTIFACT_GID:-1000}
PYTHONDONTWRITEBYTECODE: "1"
depends_on:
- web
networks:
- public_network
command: >
bash -lc "mkdir -p test-results &&
python tests/e2e/wait_for_web.py &&
pytest tests/e2e
--browser chromium
--tracing=retain-on-failure
--screenshot=only-on-failure
--junitxml=test-results/e2e-junit.xml
--html=test-results/e2e-report.html
--self-contained-html;
status=$$?;
chown -R \"$${E2E_ARTIFACT_UID}:$${E2E_ARTIFACT_GID}\" test-results || true;
exit $$status"
volumes:
ppr_e2e_mysql_data: