Skip to content

Commit eb157bc

Browse files
committed
Update Docker configuration and composer.json scripts
The composer.json scripts have been updated to enhance the Docker setup process, enabling the application to automatically download core files and create a config file on project creation. Renamed environment variables in docker-compose.yml for consistency, added volume mapping for MySQL, preserving data across container restarts.
1 parent 51f6772 commit eb157bc

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

composer.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
"require": {},
1313
"scripts": {
1414
"post-create-project-cmd": [
15-
"docker compose run app wp core download"
15+
"docker compose up -d",
16+
"docker compose exec app wp core download",
17+
"docker compose exec app wp config create --dbhost=mysql --dbname=app --dbuser=app --dbpass=secret"
1618
]
1719
}
1820
}

docker-compose.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,16 @@ services:
1414
mysql:
1515
image: mysql:8
1616
environment:
17-
MYSQL_DATABASE: ${MYSQL_DATABASE:-app}
18-
MYSQL_USER: ${MYSQL_USER:-app}
19-
MYSQL_PASSWORD: ${MYSQL_PASSWORD:-secret}
20-
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-supersecret}
17+
MYSQL_DATABASE: ${STACK_DB_DATABASE:-app}
18+
MYSQL_USER: ${STACK_DB_USER:-app}
19+
MYSQL_PASSWORD: ${STACK_DB_PASSWORD:-secret}
20+
MYSQL_ROOT_PASSWORD: ${STACK_DB_ROOT_PASSWORD:-supersecret}
21+
volumes:
22+
- mysql:/var/lib/mysql
23+
24+
volumes:
25+
mysql:
2126

2227
networks:
2328
stack:
24-
external: true
29+
external: true

0 commit comments

Comments
 (0)