Skip to content
This repository was archived by the owner on Jan 17, 2025. It is now read-only.

Commit 4d8108c

Browse files
Merge pull request #203 from creativecommons/baseline_docker_compose
Setup baseline docker-compose.yml configuration with Apache web server, latest WordPress, with a mySQL db
2 parents 043bd27 + e6edb3d commit 4d8108c

File tree

3 files changed

+68
-1
lines changed

3 files changed

+68
-1
lines changed

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,8 @@ tramp
5656
.DS_Store
5757

5858
# JavaScript / Gutenberg development
59-
node_modules/
59+
node_modules/
60+
61+
# Docker Dev
62+
/dev/db
63+
/dev/wordpress

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,35 @@ At a glance, with WP CC Plugin you can:
112112
Contributions will be very appreciated. See
113113
[`CONTRIBUTING.md`](CONTRIBUTING.md).
114114

115+
### Using a localized Docker Setup
116+
117+
A local `docker-compose.yml` file is included in the `./dev/` directory. It includes an Apache webserver, the latest WordPress installation files, and a mySQL db server utilizing MariaDB.
118+
119+
It is modelled after the official example, given here by WordPress: https://hub.docker.com/_/wordpress/
120+
121+
To run a local development environment for building and testing contributions you can run the following pattern from the root directory of this repository after cloning it.
122+
123+
`docker compose -f ./dev/docker-compose.yml [command]`
124+
125+
Be sure to substitute `[command]` for a valid docker compose command, such as:
126+
127+
`docker compose -f ./dev/docker-compose.yml up` to build and start containers
128+
129+
OR
130+
131+
`docker compose -f ./dev/docker-compose.yml down` to stop containers
132+
133+
The first time the build process is run via `docker compose -f ./dev/docker-compose.yml up`, docker will create two directories within your local repository clone:
134+
135+
- `./dev/db` where the database and relevant config will be stored
136+
- `./dev/wordpress` where the WordPress files will be stored
137+
138+
It will then mount this plugin's root directory into the `/wp-content/plugins/` directory of the WordPress installation. Edits made to your local plugin clone will reflect within the build.
139+
140+
You can then navigate to `http://localhost:8080/` and proceed with a manual WordPress installation. After the initial installation the WordPress install will persisist between docker sessions.
141+
142+
If you need to reset the WordPress install to a "clean slate" you can simply delete the `db` and `wordpress` directories respectively, and then run `docker compose -f ./dev/docker-compose.yml up` again to initialize a clean install build.
143+
115144

116145
## Release Schedule
117146

dev/docker-compose.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
version: '3.2'
2+
services:
3+
wordpress:
4+
container_name: 'local-wordpress'
5+
image: wordpress
6+
restart: always
7+
links:
8+
- db:mysql
9+
ports:
10+
- "8080:80"
11+
environment:
12+
WORDPRESS_DB_HOST: db:3306
13+
WORDPRESS_DB_USER: root
14+
WORDPRESS_DB_PASSWORD: root
15+
WORDPRESS_USER: root
16+
WORDPRESS_DB_name: wordpress
17+
depends_on:
18+
- db
19+
volumes:
20+
- ./wordpress:/var/www/html
21+
- ../.:/var/www/html/wp-content/plugins/wp-plugin-creativecommons
22+
# Ignore these directories when mounting the root into /var/www/html/wp-content/plugins/wp-plugin-creativecommons so they are not included
23+
- /var/www/html/wp-content/plugins/wp-plugin-creativecommons/dev/wordpress
24+
- /var/www/html/wp-content/plugins/wp-plugin-creativecommons/dev/db
25+
db:
26+
container_name: 'local-wordpress-db'
27+
image: mariadb
28+
restart: always
29+
environment:
30+
MYSQL_DATABASE: wordpress
31+
MYSQL_USER: root
32+
MYSQL_ROOT_PASSWORD: root
33+
volumes:
34+
- ./db:/var/lib/mysql

0 commit comments

Comments
 (0)