bilhej/build.gradle
Joakim Mörling e05f74bd82 chore: add Docker CI compose, Gradle E2E task, and .dockerignore
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.
2026-05-13 19:17:55 +02:00

44 lines
1.3 KiB
Groovy

plugins {
id 'base'
}
tasks.register('frontendLint', Exec) {
description = 'Run ESLint in the frontend directory'
workingDir = file("${rootProject.projectDir}/frontend")
commandLine 'npm', 'run', 'lint'
}
tasks.register('frontendTest', Exec) {
description = 'Run Vitest in the frontend directory'
dependsOn frontendLint
workingDir = file("${rootProject.projectDir}/frontend")
commandLine 'npm', 'run', 'test'
}
tasks.register('frontendE2E', Exec) {
description = 'Run Playwright E2E tests in Docker (CI mode)'
workingDir = file("${rootProject.projectDir}/frontend")
commandLine 'npm', 'run', 'test:e2e:ci'
}
tasks.named('check').configure {
dependsOn frontendLint, frontendTest
}
tasks.register('up', Exec) {
description = 'Start all services via Docker Compose'
workingDir = rootProject.projectDir
commandLine 'docker', 'compose', 'up', '-d'
}
tasks.register('down', Exec) {
description = 'Stop all Docker Compose services'
workingDir = rootProject.projectDir
commandLine 'docker', 'compose', 'down'
}
tasks.register('reset', Exec) {
description = 'Wipe database and restart all services'
workingDir = rootProject.projectDir
commandLine 'bash', '-c', 'docker compose down -v && docker compose up -d'
}