-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added docker files so a plugin dev an quickly test
* Run ./docker.sh to start the process instead of running docker-compose up - This way the wordpress plugins folder can be directly edited from your host system
- Loading branch information
Showing
3 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
CONTAINER=wordpress | ||
WORDPRESS_HTTP_PORT=8000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
version: '3.3' | ||
|
||
services: | ||
db: | ||
image: mysql:5.7 | ||
volumes: | ||
- db_data:/var/lib/mysql | ||
restart: always | ||
environment: | ||
MYSQL_ROOT_PASSWORD: somewordpress | ||
MYSQL_DATABASE: wordpress | ||
MYSQL_USER: wordpress | ||
MYSQL_PASSWORD: wordpress | ||
|
||
wordpress: | ||
depends_on: | ||
- db | ||
image: wordpress:latest | ||
ports: | ||
- "${WORDPRESS_HTTP_PORT}:80" | ||
restart: always | ||
container_name: "${CONTAINER}" | ||
environment: | ||
WORDPRESS_DB_HOST: db:3306 | ||
WORDPRESS_DB_USER: wordpress | ||
WORDPRESS_DB_PASSWORD: wordpress | ||
WORDPRESS_DB_NAME: wordpress | ||
WORDPRESS_DEBUG: 1 | ||
working_dir: /var/www/html | ||
volumes: | ||
- ./docker-instance-files/plugins:/var/www/html/wp-content/plugins | ||
- ./docker-instance-files/uploads.ini:/usr/local/etc/php/conf.d/uploads.ini | ||
volumes: | ||
db_data: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# The purpose of this script is to provide write access to the wordpress plugins folder for | ||
# both the host machine and the docker container itself. | ||
# This makes plugin testing much easy as the the file in the plugins folder can be directly | ||
# edited on the host machine's IDE. | ||
# This means no more needing to copy files from host->container or using vim in the container! | ||
|
||
export $(xargs < .env) | ||
|
||
USER_ID=`id -u` | ||
GROUP_ID=`id -g` | ||
|
||
# Starting docker images without allowing them to execute anything yet. | ||
# This is so we can correctly set the permission below before it starts creating files | ||
echo "Starting $CONTAINER in --no-start mode" | ||
docker-compose up --no-start $CONTAINER | ||
docker-compose up --detach $CONTAINER | ||
|
||
echo "Wait for all wordpress files to be comes available" | ||
docker exec -ti $CONTAINER /bin/bash -c 'until [[ -f .htaccess ]]; do sleep 1; done' | ||
|
||
echo "Allowing Wordpress container to modify any files in the docker-instance-file/plugins folder" | ||
docker exec -ti $CONTAINER /bin/bash -c "usermod -u ${USER_ID} www-data" | ||
docker exec -ti $CONTAINER /bin/bash -c "groupmod -g ${GROUP_ID} www-data" | ||
echo "Restart container for permsision settings to take effect" | ||
docker container restart $CONTAINER | ||
|
||
echo "Updating '/var/www' folder ownership" | ||
docker exec -ti $CONTAINER /bin/bash -c 'chown -R www-data:www-data /var/www' | ||
|
||
echo "Started Scuessfully!" | ||
echo "──────────────────────────────────────────────────────" | ||
|
||
echo "Tailing logs" | ||
docker-compose up |