File tree Expand file tree Collapse file tree 4 files changed +33
-1
lines changed
Expand file tree Collapse file tree 4 files changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -130,4 +130,5 @@ typings/
130130# dotenv environment variables file
131131.env
132132
133-
133+ # ## MariaDB
134+ /mariadb
Original file line number Diff line number Diff line change @@ -35,11 +35,21 @@ To stop the stack, run:
3535
3636---
3737
38+ To connect to the MariaDB service, run:
39+
40+ docker-compose exec mariadb mysql -uapp -p
41+
42+ - This command uses the ` app ` user. There is also a ` root ` user.
43+ - Use the password defined on the ` docker-compose.yml ` file.
44+
45+ ---
46+
3847To install composer dependencies, run:
3948
4049 docker-compose run --rm composer install
4150
4251- The ` --rm ` flag ensures that that intermediate (temporary) containers are deleted once you install packages (to save disk space).
52+ - The service's data is mounted on the ` ./mariadb ` host folder, which means that data will persist between ` docker-compose ` ` up ` s and ` stop ` s.
4353
4454---
4555
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ services:
55 image : busybox:latest
66 volumes :
77 - ./:/var/www
8+ - ./mariadb:/var/lib/mysql:rw
89 php-fpm :
910 build :
1011 context : ./services/php
@@ -18,11 +19,26 @@ services:
1819 context : ./services/composer
1920 volumes :
2021 - ./:/app
22+ mariadb :
23+ build :
24+ context : ./services/mariadb
25+ ports :
26+ - 3306:3306
27+ volumes_from :
28+ - workspace
29+ environment :
30+ - " MYSQL_DATABASE=app"
31+ - " MYSQL_USER=app"
32+ - " MYSQL_PASSWORD=secret"
33+ - " MYSQL_ROOT_PASSWORD=secret"
2134 node :
2235 build :
2336 context : ./services/node
2437 volumes_from :
2538 - workspace
39+
2640volumes :
2741 php-fpm :
2842 driver : " local"
43+ mariadb :
44+ driver : " local"
Original file line number Diff line number Diff line change 1+ FROM mariadb:10.3
2+
3+ EXPOSE 3306
4+
5+ CMD ["mysqld" ]
You can’t perform that action at this time.
0 commit comments