-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.test.yml
More file actions
45 lines (42 loc) · 1.12 KB
/
docker-compose.test.yml
File metadata and controls
45 lines (42 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
version: '3.8'
services:
test:
build:
context: .
dockerfile: Dockerfile
target: test
container_name: demo-tests
volumes:
# Mount source code for development
- ./src:/app/src:ro
# Mount test reports output
- ./target:/app/target
environment:
# Test-specific environment variables
- SPRING_PROFILES_ACTIVE=test
- SPRING_DATASOURCE_URL=jdbc:h2:mem:testdb
- SPRING_DATASOURCE_DRIVER_CLASS_NAME=org.h2.Driver
- SPRING_JPA_HIBERNATE_DDL_AUTO=create-drop
networks:
- test-network
# Optional: Run tests with coverage
test-with-coverage:
build:
context: .
dockerfile: Dockerfile
target: base
container_name: demo-test-coverage
command: mvn clean test jacoco:report
volumes:
- ./src:/app/src:ro
- ./target:/app/target
environment:
- SPRING_PROFILES_ACTIVE=test
- SPRING_DATASOURCE_URL=jdbc:h2:mem:testdb
- SPRING_DATASOURCE_DRIVER_CLASS_NAME=org.h2.Driver
- SPRING_JPA_HIBERNATE_DDL_AUTO=create-drop
networks:
- test-network
networks:
test-network:
driver: bridge