Skip to content

Commit 6f6a66c

Browse files
FEAT:created .env file to store database name and credentials
1 parent d0316c7 commit 6f6a66c

File tree

4 files changed

+26
-21
lines changed

4 files changed

+26
-21
lines changed

.env

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
MYSQL_DATABASE_NAME=exampledatabase
2+
MYSQL_USER=exampleuser
3+
MYSQL_PASSWORD=examplepass
4+
WORDPRESS_PORT=8000

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# Ignore this folders
12
/db
23
/plugins
34
/themes

docker-compose.yml

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ services:
77
image: mysql:5.7
88
restart: always
99
environment:
10-
MYSQL_DATABASE: exampledb
11-
MYSQL_USER: exampleuser
12-
MYSQL_PASSWORD: examplepass
13-
MYSQL_RANDOM_ROOT_PASSWORD: '1'
10+
MYSQL_DATABASE: ${MYSQL_DATABASE_NAME}
11+
MYSQL_USER: ${MYSQL_USER}
12+
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
13+
MYSQL_RANDOM_ROOT_PASSWORD: 'root'
1414
volumes:
1515
- ./db:/var/lib/mysql
1616

@@ -26,8 +26,8 @@ services:
2626
- "8080:80"
2727
environment:
2828
PMA_HOST: db
29-
PMA_USER: exampleuser
30-
PMA_PASSWORD: examplepass
29+
PMA_USER: ${MYSQL_USER}
30+
PMA_PASSWORD: ${MYSQL_PASSWORD}
3131

3232

3333

@@ -38,14 +38,13 @@ services:
3838
depends_on:
3939
- db
4040
ports:
41-
- 8000:80
41+
- ${WORDPRESS_PORT}:80
4242
environment:
4343
WORDPRESS_DB_HOST: db:3306
44-
WORDPRESS_DB_USER: exampleuser
45-
WORDPRESS_DB_PASSWORD: examplepass
46-
WORDPRESS_DB_NAME: exampledb
44+
WORDPRESS_DB_USER: ${MYSQL_USER}
45+
WORDPRESS_DB_PASSWORD: ${MYSQL_PASSWORD}
46+
WORDPRESS_DB_NAME: ${MYSQL_DATABASE_NAME}
4747
volumes:
48-
#- wp_data:/var/www/html
4948
- ./plugins:/var/www/html/wp-content/plugins
5049
- ./themes:/var/www/html/wp-content/themes
5150

@@ -61,8 +60,8 @@ services:
6160
- wordpress
6261
environment:
6362
WORDPRESS_DB_HOST: db:3306
64-
WORDPRESS_DB_USER: exampleuser
65-
WORDPRESS_DB_PASSWORD: examplepass
66-
WORDPRESS_DB_NAME: exampledb
67-
entrypoint: wp
63+
WORDPRESS_DB_USER: ${MYSQL_USER}
64+
WORDPRESS_DB_PASSWORD: ${MYSQL_PASSWORD}
65+
WORDPRESS_DB_NAME: ${MYSQL_DATABASE_NAME}
66+
entrypoint: wp
6867
command: "--info"

readme.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
# Docker WordPress Environment
22

3-
Services
3+
This is a basic **Docker Wordpress Environment** focused on development of **plugins and themes**, supports [WP-CLI](https://wp-cli.org/) and [phpMyAdmin](https://www.phpmyadmin.net/).
4+
5+
Clone this repository, then run `docker-compose up -d`
6+
7+
## Services
48

59
- db
6-
image: mysql:5.7
10+
The mysql
711

812
- phpmyadmin
9-
image: phpmyadmin/phpmyadmin:latest
1013

1114
- wordpress
12-
image: wordpress oficial
15+
Uses the official WordPress docker image
1316

1417
- wpcli
15-
image: wordpress:cli
16-
1718
The **wpcli container** was added in order to only run one-off commands. Don’t need it to run as a service, only as a cli tool, for that run:
1819

1920
`docker-compose run --rm wpcli command`

0 commit comments

Comments
 (0)