Skip to content

Commit

Permalink
Initial Docker support
Browse files Browse the repository at this point in the history
Docker support for Wordpress Unit Testing
  • Loading branch information
vincentkoc committed Jan 21, 2019
1 parent f298367 commit 060b884
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
WORDPRESS_DB_NAME=test
WORDPRESS_DB_USER=test
WORDPRESS_DB_PASSWORD=test

MYSQL_ROOT_PASSWORD=test
MYSQL_DATABASE=test
MYSQL_USER=test
MYSQL_PASSWORD=test
11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM wordpress:php5.6

RUN apt-get update && apt-get install -y less wget subversion mysql-client

RUN wget https://phar.phpunit.de/phpunit-6.5.phar && \
chmod +x phpunit-6.5.phar && \
mv phpunit-6.5.phar /usr/local/bin/phpunit

RUN curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar && \
chmod +x wp-cli.phar && \
mv wp-cli.phar /usr/local/bin/wp
27 changes: 27 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
version: "2"
services:
wordpress:
build:
context: .
dockerfile: Dockerfile
ports:
- "8888:80"
depends_on:
- db
environment:
WORDPRESS_DB_HOST: "db:3306"
env_file: .env
volumes:
- .:/var/www/html/wp-content/plugins/plugin
- for-testing:/tmp
db:
image: mysql:latest
env_file: .env
volumes:
- db-data:/var/lib/mysql

volumes:
db-data:
driver: local
for-testing:
driver: local
10 changes: 10 additions & 0 deletions phpcs.ruleset.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0"?>
<ruleset name="WordPress Coding Standards for Plugins">
<description>Generally-applicable sniffs for WordPress plugins</description>

<rule ref="WordPress-Core" />
<rule ref="WordPress-Docs" />

<exclude-pattern>*/node_modules/*</exclude-pattern>
<exclude-pattern>*/vendor/*</exclude-pattern>
</ruleset>

0 comments on commit 060b884

Please sign in to comment.