Add infrastructure for running Playwright E2E tests in Docker and fix Gradle lock conflicts between host and container builds. Changes: - Add docker-compose.ci.yml that starts postgres, backend, frontend, and a Playwright service for CI pipelines. Uses official mcr.microsoft.com/playwright:v1.60.0-noble image. - Add backend-gradle-project named volume to docker-compose.yml so the container's .gradle/ directory is isolated from the host's. This prevents stale lock files from host Gradle builds (e.g. ./gradlew :backend:test) crashing the container's bootRun. - Add .dockerignore excluding .gradle, .env, .git, frontend/node_modules, and backend/build from the Docker build context. - Add frontendE2E Gradle task that runs npm run test:e2e:ci.
63 lines
1.7 KiB
YAML
63 lines
1.7 KiB
YAML
services:
|
|
postgres:
|
|
image: postgres:16
|
|
container_name: bilhej-postgres-ci
|
|
environment:
|
|
POSTGRES_DB: ${POSTGRES_DB}
|
|
POSTGRES_USER: ${POSTGRES_USER}
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 5
|
|
|
|
backend:
|
|
build:
|
|
dockerfile: docker/backend.Dockerfile
|
|
context: .
|
|
container_name: bilhej-backend-ci
|
|
environment:
|
|
SPRING_PROFILES_ACTIVE: docker
|
|
POSTGRES_DB: ${POSTGRES_DB}
|
|
POSTGRES_USER: ${POSTGRES_USER}
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
|
|
JWT_SECRET: ${JWT_SECRET}
|
|
STRIPE_SECRET_KEY: ${STRIPE_SECRET_KEY}
|
|
STRIPE_WEBHOOK_SECRET: ${STRIPE_WEBHOOK_SECRET}
|
|
STRIPE_PRICE_ID: ${STRIPE_PRICE_ID}
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
volumes:
|
|
- .:/app
|
|
- gradle-cache:/root/.gradle
|
|
|
|
frontend:
|
|
build:
|
|
dockerfile: docker/frontend.Dockerfile
|
|
context: .
|
|
container_name: bilhej-frontend-ci
|
|
depends_on:
|
|
- backend
|
|
|
|
playwright:
|
|
image: mcr.microsoft.com/playwright:v1.60.0-noble
|
|
container_name: bilhej-playwright
|
|
ipc: host
|
|
working_dir: /app
|
|
environment:
|
|
PLAYWRIGHT_BASE_URL: http://frontend:3000
|
|
volumes:
|
|
- ./frontend/package.json:/app/package.json
|
|
- ./frontend/package-lock.json:/app/package-lock.json
|
|
- ./frontend/playwright.config.ts:/app/playwright.config.ts
|
|
- ./frontend/e2e:/app/e2e
|
|
- ./frontend/node_modules:/app/node_modules
|
|
depends_on:
|
|
- frontend
|
|
command: >
|
|
sh -c "npm ci --ignore-scripts && npx playwright test --reporter=list"
|
|
|
|
volumes:
|
|
gradle-cache:
|