Skip to content

Commit 1a0e857

Browse files
committed
Add Travis CI tests.
1 parent 3c61b7e commit 1a0e857

File tree

3 files changed

+35
-2
lines changed

3 files changed

+35
-2
lines changed

.travis.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
language: python
3+
services: docker
4+
5+
install:
6+
# Install Ansible.
7+
- pip install ansible
8+
9+
script:
10+
# Build the container.
11+
- ansible-playbook main.yml
12+
13+
# Verify the container runs and returns the default welcome page.
14+
- docker run -d --name=php -p 80:80 php-apache:latest /usr/sbin/apache2ctl -D FOREGROUND
15+
- curl http://localhost/
16+
17+
# notifications:
18+
# webhooks: https://galaxy.ansible.com/api/v1/notifications/

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,17 @@ Or, if using a Docker Compose file:
6161

6262
If you wish to build an image using this image as the base (e.g. for deploying to production), create a Dockerfile and `COPY` the webroot into place so it's part of the image.
6363

64+
If you want to run multiple webroots, or need to further customize the Apache VirtualHost definitions, you can mount a config file over the existing one in the container, e.g.:
65+
66+
services:
67+
myapp:
68+
...
69+
volumes:
70+
- ./web:/var/www/html:rw,delegated
71+
- ./virtualhosts.conf:/etc/apache2/sites-enabled/vhosts.conf:rw
72+
73+
Similarly, you can mount a PHP config file to the path `/etc/php/TODO`.
74+
6475
## Management with Ansible
6576

6677
### Prerequisites

main.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,12 @@
66
vars:
77
base_image: debian:stretch
88
container_name: build_container
9-
image_name: php
9+
image_name: php-apache
1010

11+
# Apache settings.
12+
apache_remove_default_vhost: yes
13+
14+
# PHP settings.
1115
php_version: '7.2'
1216
php_packages_extra:
1317
- libapache2-mod-php
@@ -58,7 +62,7 @@
5862
post_tasks:
5963
- name: Clean up the container.
6064
shell: >
61-
apt-get remove --purge -y python
65+
apt-get remove --purge -y python &&
6266
rm -rf /var/lib/apt/lists/*
6367
delegate_to: '{{ container_name }}'
6468

0 commit comments

Comments
 (0)