File tree 4 files changed +73
-3
lines changed 4 files changed +73
-3
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ COPY ./config/supervisor/ /etc/supervisor/
38
38
COPY --from=composer /usr/bin/composer /usr/bin/composer
39
39
40
40
# Custom entrypoint to run the app as scheduler or queue worker
41
- COPY ./build/docker-entrypoint /usr/local/bin/
41
+ COPY ./build/docker-entrypoint /usr/local/bin/
42
42
CMD ["/usr/local/bin/docker-entrypoint" ]
43
43
44
44
@@ -53,12 +53,15 @@ USER webdev
53
53
54
54
# Copy existing application directory contents and change
55
55
# ownership of the application files so that they are not
56
- # writable by Apache's www-user.
56
+ # writable by Apache's www-user
57
57
COPY --chown=webdev:webdev $SRC ./
58
58
59
59
# Set proper permissions + install dependencies using Composer
60
60
RUN chmod -R 777 bootstrap/cache storage \
61
61
&& composer install --no-interaction --no-plugins --prefer-dist --ansi
62
62
63
+ # Add test script for automated testing
64
+ COPY ./build/run_tests.sh /usr/local/bin/run_tests
65
+
63
66
# Switch default user back to root
64
67
USER root
Original file line number Diff line number Diff line change
1
+ version : ' 3.7'
2
+
3
+ # Docker Network
4
+ networks :
5
+ network :
6
+ driver : bridge
7
+
8
+ services :
9
+ # Apache + PHP
10
+ sut :
11
+ build :
12
+ context : ../
13
+ dockerfile : build/Dockerfile
14
+ environment :
15
+ - CONTAINER_ROLE=app
16
+ - DB_HOST=db
17
+ - DB_PORT=3306
18
+ - DB_DATABASE=laraveldock
19
+ - DB_USERNAME=root
20
+ - DB_PASSWORD=root
21
+ - REDIS_HOST=redis
22
+ - REDIS_PORT=6379
23
+ - REDIS_PASSWORD=
24
+ command : run_tests
25
+ depends_on :
26
+ - db
27
+ - redis
28
+ networks :
29
+ - network
30
+
31
+ # MySQL
32
+ db :
33
+ image : mysql:5.7
34
+ command : ["--character-set-server=utf8mb4", "--collation-server=utf8mb4_unicode_ci"]
35
+ environment :
36
+ - MYSQL_ROOT_PASSWORD=root
37
+ - MYSQL_DATABASE=laraveldock
38
+ networks :
39
+ - network
40
+
41
+ # Redis
42
+ redis :
43
+ image : redis:5.0
44
+ command : ["redis-server", "--appendonly", "yes"]
45
+ networks :
46
+ - network
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ echo -n " Waiting for MySQL.."
4
+
5
+ while ! mysql --protocol TCP -h" ${DB_HOST} " -u" ${DB_USERNAME} " -p" ${DB_PASSWORD} " -e" show databases;" > /dev/null 2>&1 ; do
6
+ echo -n .
7
+ sleep 1
8
+ (( counter++ ))
9
+
10
+ if [ $counter -gt 45 ]; then
11
+ >&2 echo " failed"
12
+ exit 1
13
+ fi
14
+ done
15
+
16
+ echo " OK"
17
+
18
+ php artisan migrate --force
19
+
20
+ vendor/bin/phpunit
Original file line number Diff line number Diff line change 24
24
</filter >
25
25
<php >
26
26
<env name =" APP_ENV" value =" testing" />
27
+ <env name =" APP_KEY" value =" testtesttesttesttesttesttesttest" />
27
28
<env name =" BCRYPT_ROUNDS" value =" 4" />
28
- <env name =" CACHE_DRIVER" value =" array " />
29
+ <env name =" CACHE_DRIVER" value =" redis " />
29
30
<env name =" MAIL_DRIVER" value =" array" />
30
31
<env name =" QUEUE_CONNECTION" <
3F1A
span class="pl-e">value=" sync" />
31
32
<env name =" SESSION_DRIVER" value =" array" />
You can’t perform that action at this time.
0 commit comments