Skip to content

Commit 9fdf0c2

Browse files
committed
Added make test, refactored Makefile, set container to not run as root.
1 parent 2f6c0e7 commit 9fdf0c2

File tree

3 files changed

+28
-3
lines changed

3 files changed

+28
-3
lines changed

Dockerfile

+4
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,7 @@ RUN npm install grunt-cli -g
3333

3434
ENV PATH="/root/.composer/vendor/bin:${PATH}"
3535
ENV WP_VERSION="4.9.1"
36+
37+
# DONT run as ROOT
38+
RUN useradd -ms /bin/bash phpcompat
39+
USER phpcompat

Makefile

+10-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
SHELL := /bin/bash
2+
DC_DEV = docker-compose -f docker-compose.yml
23

34
# WordPress management via docker-compose
5+
run:
6+
$(DC_DEV) up
7+
48
start:
5-
docker-compose -f docker-compose.yml up -d
9+
$(DC_DEV) up -d
610

711
stop:
8-
docker-compose -f docker-compose.yml stop
12+
$(DC_DEV) stop
913

1014
# One liner to get a shell inside the WordPress container.
11-
shell:
15+
shell: start
1216
docker-compose exec wordpress /bin/bash -c "cd /var/www/html/wp-content/plugins/phpcompat/; /bin/bash"
17+
18+
test: start
19+
docker-compose exec wordpress /bin/bash -c "/var/www/html/wp-content/plugins/phpcompat/bin/test.sh"

bin/test.sh

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
PLUGIN_ROOT="/var/www/html/wp-content/plugins/phpcompat/"
6+
7+
main()
8+
{
9+
cd "$PLUGIN_ROOT"
10+
11+
phpunit
12+
}
13+
14+
main "$@"

0 commit comments

Comments
 (0)