Skip to content

Commit ac434c2

Browse files
committed
Update the files
1 parent 73ed472 commit ac434c2

File tree

10 files changed

+2221
-2433
lines changed

10 files changed

+2221
-2433
lines changed

backend/README.md

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
## 🎨 WordPress Docker Example
2+
[![Project Status: Active.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
3+
![Stars](https://img.shields.io/github/stars/imranhsayed/wordpress-docker-example?label=%E2%AD%90%20Stars)
4+
![Forks](https://img.shields.io/github/forks/imranhsayed/wordpress-docker-example?color=%23ff69b4)
5+
![Contributors](https://img.shields.io/github/contributors/imranhsayed/wordpress-docker-example?color=blue)
6+
![Follow](https://img.shields.io/github/followers/imranhsayed?label=Please%20follow%20%20to%20support%20my%20work%20%F0%9F%99%8F&style=social)
7+
8+
- WordPress Setup with Docker.
9+
- mysql
10+
- phpMyAdmin
11+
12+
## Setup
13+
Run this from root
14+
```bash
15+
docker-compose -f docker-compose.yml up -d
16+
```
17+
18+
*WordPress* will be available on [http://localhost:8020](http://localhost:8020)
19+
20+
*[phpMyAdmin](https://github.com/phpmyadmin/phpmyadmin)*: You can access php myadmin on [http://localhost:8183](http://localhost:8183)
21+
```shell script
22+
port: mysql:3306
23+
username: root
24+
password: root
25+
```
26+
27+
phpmyadmin docker image already comes with the username `root` and we have set the mysql password in the dockerfile
28+
29+
* If you happen to use your own WordPress setup, be sure to install and activate plugins from composer.json and add your own WordPress site URL
30+
in an .env file, You can check the .env-example file for reference.
31+
32+
## Development ( Developers only )
33+
34+
1. When we change the composer.json, run from root
35+
```shell script
36+
docker-compose -f docker-compose.yml down && \
37+
docker-compose -f docker-compose.yml up -d
38+
```
39+
40+
First line command will stops and removes all the docker containers and second line command will restart all containers.
41+
Notice that `-d` is to run in detach mode and you can always remove that flag, and run the command so you can see the live logs.
42+
Or you can check the logs for
43+
44+
2. Check the logs
45+
While the above command is running in detached mode ( -d ), you can run this command in a new terminal tab to see the live logs.
46+
```shell script
47+
docker logs -f container-name
48+
```
49+
50+
e.g.
51+
```bash
52+
docker container ls
53+
```
54+
55+
#### result
56+
```shell script
57+
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
58+
d0b4a3b0074f wordpress:latest "docker-entrypoint.s…" About a minute ago Up About a minute 0.0.0.0:8000->80/tcp backend_wordpress_1
59+
aad078ebe131 mysql:5.7 "docker-entrypoint.s…" About a minute ago Up About a minute 3306/tcp, 33060/tcp backend_db_1
60+
```
61+
Here container-name is `backend_db_1` or `backend_wordpress_1`
62+
63+
3. If you make changes to docker-compose.yml file, run the following:
64+
65+
If you happend to change the port in `docker-compose.yml` make sure to delete the `db` directory and then run below.
66+
67+
```shell script
68+
docker-compose -f docker-compose.yml down && \
69+
docker-compose -f docker-compose.yml up -d
70+
```
71+
72+
## Debugging
73+
74+
1. If you get 404 on requests, check to see that the .htaccess file in wordpress directory has the rules
75+
76+
```shell script
77+
# BEGIN WordPress
78+
# The directives (lines) between "BEGIN WordPress" and "END WordPress" are
79+
# dynamically generated, and should only be modified via WordPress filters.
80+
# Any changes to the directives between these markers will be overwritten.
81+
<IfModule mod_rewrite.c>
82+
RewriteEngine On
83+
RewriteBase /
84+
RewriteRule ^index\.php$ - [L]
85+
RewriteCond %{REQUEST_FILENAME} !-f
86+
RewriteCond %{REQUEST_FILENAME} !-d
87+
RewriteRule . /index.php [L]
88+
</IfModule>
89+
90+
# END WordPress
91+
```
92+
93+
## References for Docker Images.
94+
95+
1. [phpMyAdmin](https://github.com/fuadajip/dockercompose-mysql-phpmyadmin/blob/master/docker-compose.yml)

backend/docker-compose.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ services:
3636
depends_on:
3737
- mysql
3838
- composer
39-
build: ./php
40-
image: wordpress_image
39+
image: wordpress:latest
4140
ports:
4241
- "8020:80"
4342
restart: always

backend/php/Dockerfile

Lines changed: 0 additions & 127 deletions
This file was deleted.

0 commit comments

Comments
 (0)