Skip to content

Commit 6c28100

Browse files
committed
Issue #1: Support all maintained major PHP versions."
1 parent ca6c512 commit 6c28100

File tree

7 files changed

+29
-7
lines changed

7 files changed

+29
-7
lines changed

.travis.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
language: python
33
services: docker
44

5+
env:
6+
- php_version: '7.2'
7+
- php_version: '7.1'
8+
- php_version: '7.0'
9+
- php_version: '5.6'
10+
511
install:
612
# Install Ansible.
713
- pip install ansible docker-py
@@ -11,11 +17,11 @@ install:
1117

1218
script:
1319
# Build the container.
14-
- ansible-playbook main.yml
20+
- ansible-playbook --extra-vars="@vars/${php_version}.yml" main.yml
1521

16-
# Verify the container runs and returns the default welcome page.
17-
- docker run -d --name=php -p 8080:80 php-apache:latest /usr/sbin/apache2ctl -D FOREGROUND
18-
- docker ps
22+
# Verify the container runs and has the correct PHP version.
23+
- docker run -d --name=php-apache -p 8080:80 php-apache:latest /usr/sbin/apache2ctl -D FOREGROUND
24+
- docker exec php-apache php -v | grep ${php_version}
1925
- curl http://localhost:8080/
2026

2127
# notifications:

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ First, install Ansible role requirements:
8989

9090
Then, make sure Docker is running, and run the playbook to build the container:
9191

92-
ansible-playbook main.yml
92+
ansible-playbook --extra-vars="@vars/7.2.yml" main.yml
9393

94-
Once the image is built, you can run `docker images` to see the `php-apache` image that was generated.
94+
(Substitute whatever supported PHP version you desire in the vars path) Once the image is built, you can run `docker images` to see the `php-apache` image that was generated.
9595

9696
> Note: If you get an error like `Failed to import docker-py`, run `pip install docker-py`.
9797

main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# PHP settings.
1515
php_version: '7.2'
1616
php_packages_extra:
17-
- libapache2-mod-php
17+
- libapache2-mod-php7.2
1818
php_install_recommends: no
1919

2020
pre_tasks:

vars/5.6.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
php_version: '5.6'
3+
php_packages_extra:
4+
- libapache2-mod-php5.6

vars/7.0.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
php_version: '7.0'
3+
php_packages_extra:
4+
- libapache2-mod-php7.0

vars/7.1.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
php_version: '7.1'
3+
php_packages_extra:
4+
- libapache2-mod-php7.1

vars/7.2.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
php_version: '7.2'
3+
php_packages_extra:
4+
- libapache2-mod-php7.2

0 commit comments

Comments
 (0)