-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.test.yml
More file actions
60 lines (54 loc) · 1.54 KB
/
docker-compose.test.yml
File metadata and controls
60 lines (54 loc) · 1.54 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
version: '3.8'
services:
shellock-test:
build:
context: .
dockerfile: Dockerfile
environment:
- APP_ENV=test
- DATABASE_URL=mysql://ssh_test:ssh_test_password@mariadb-test:3306/ssh_test?serverVersion=mariadb-10.11.0
volumes:
- .:/var/www/html
depends_on:
mariadb-test:
condition: service_healthy
networks:
- ssh-test-network
entrypoint: []
command: >
bash -c "
# Wait for database to be ready
echo 'Waiting for database to be ready...'
until mysql -hmariadb-test -ussh_test -pssh_test_password -e 'SELECT 1;' ssh_test > /dev/null 2>&1; do
echo 'Database not ready, waiting...'
sleep 3
done
echo 'Database is ready!'
# Install dependencies
composer install
# Create database schema
php bin/console doctrine:schema:create --env=test
# Run tests
./vendor/bin/phpunit
"
mariadb-test:
image: mariadb:10.11
environment:
MYSQL_ROOT_PASSWORD: root_test_password
MYSQL_DATABASE: ssh_test
MYSQL_USER: ssh_test
MYSQL_PASSWORD: ssh_test_password
volumes:
- ./docker/test-db-init.sql:/docker-entrypoint-initdb.d/init.sql
networks:
- ssh-test-network
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "ssh_test", "-pssh_test_password"]
interval: 10s
timeout: 5s
retries: 5
tmpfs:
- /var/lib/mysql:rw,noexec,nosuid,size=1024m
networks:
ssh-test-network:
driver: bridge