Skip to content

Commit 515818d

Browse files
authored
Merge pull request #7 from rtucek/release/v0.3.0
Release/v0.3.0 - Add Travis CI - #1 - Add Xdebug - #2
2 parents 9bf5bcc + e498ecd commit 515818d

File tree

6 files changed

+49
-2
lines changed

6 files changed

+49
-2
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.editorconfig
2+
.travis.yml
23
CHANGELOG.md
34
LICENSE
45
Makefile

.travis.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
sudo: false
2+
3+
services:
4+
- docker
5+
6+
addons:
7+
apt:
8+
packages:
9+
- make
10+
11+
script:
12+
- make test-build

Dockerfile

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ FROM debian:jessie
22

33
ENV \
44
NGINX_VERSION=1.11.8 \
5-
PHP_VERSION=7.1.0
5+
PHP_VERSION=7.1.0 \
6+
XDEBUG_VERSION=2.5.0
67

78
COPY \
89
docker-entrypoint \
@@ -16,6 +17,7 @@ RUN \
1617
apt-get update && \
1718
apt-get install -y --no-install-recommends \
1819
# In general...
20+
autoconf \
1921
build-essential \
2022
curl \
2123

@@ -152,6 +154,18 @@ RUN \
152154
make -j$(nproc) build && \
153155
make install && \
154156

157+
# Compile Xdebug
158+
mkdir -p /tmp/build/xdebug && \
159+
cd /tmp/build/xdebug && \
160+
curl -SLO \
161+
"https://github.com/xdebug/xdebug/archive/XDEBUG_"$(echo ${XDEBUG_VERSION} | sed "s/\./_/g")".tar.gz" && \
162+
tar -xvzf "XDEBUG_"$(echo ${XDEBUG_VERSION} | sed "s/\./_/g")".tar.gz" && \
163+
cd "xdebug-XDEBUG_"$(echo ${XDEBUG_VERSION} | sed "s/\./_/g") && \
164+
phpize && \
165+
./configure && \
166+
make && \
167+
make install && \
168+
155169
# Fix permissions
156170
chown -R www-data:www-data /usr/local/nginx/html && \
157171

@@ -206,6 +220,7 @@ RUN \
206220

207221
# Final cleanup
208222
apt-get remove -y \
223+
autoconf \
209224
bison \
210225
build-essential \
211226
curl \

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,6 @@ default: build
1111

1212
build:
1313
docker build -t $(IMAGE_FQN) .
14+
15+
test-build:
16+
docker build -t testbuild .

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[![](https://images.microbadger.com/badges/image/janus1990/docker-nginx-php.svg)](https://microbadger.com/images/janus1990/docker-nginx-php "Get your own image badge on microbadger.com") [![](https://images.microbadger.com/badges/version/janus1990/docker-nginx-php.svg)](https://microbadger.com/images/janus1990/docker-nginx-php "Get your own version badge on microbadger.com")
1+
[![Build Status](https://travis-ci.org/rtucek/docker-nginx-php.svg?branch=ci%2Ftravis)](https://travis-ci.org/rtucek/docker-nginx-php) [![](https://images.microbadger.com/badges/image/janus1990/docker-nginx-php.svg)](https://microbadger.com/images/janus1990/docker-nginx-php "Get your own image badge on microbadger.com") [![](https://images.microbadger.com/badges/version/janus1990/docker-nginx-php.svg)](https://microbadger.com/images/janus1990/docker-nginx-php "Get your own version badge on microbadger.com")
22

33
## nginx-php Dockerfile
44

@@ -10,6 +10,9 @@ Nginx and PHP are compiled in a specific version. Consult the [CHANGELOG.md](./C
1010
for further version details. [PHP Composer](https://getcomposer.org/) is already installed and ready
1111
for use.
1212

13+
Xdebug is installed as shared extension, but not activated. Start the container with env
14+
ENABLE_XDEBUG=1 to enable the extension.
15+
1316
The Nginx and PHP-FPM master processes are controlled by [Honcho](https://github.com/nickstenning/honcho).
1417
Honcho was chosen over Supervisor, because honcho will exit and kill the container if either Nginx
1518
or PHP's master process dye for any reason. If you want have to have the container restarted
@@ -42,6 +45,12 @@ Mount your custom `nginx.conf` file at `/usr/local/nginx/conf/nginx.conf`.
4245
* Mount your custom `www.conf` file at `/usr/local/etc/www.conf`.
4346
* Mount your custom `php.ini` file at `/usr/local/php/php.ini`.
4447

48+
### Xdebug
49+
50+
Xdebug was installed mainly with the idea of providing code coverage for PHPUnit. Thus it's not
51+
configured for any specific use case. You can [configure Xdebug](https://xdebug.org/docs/all) via
52+
`php.ini` if desired.
53+
4554
### Honcho
4655

4756
If you want to overwrite the default Honcho configuration - mount your custom `Procfile` file at `/`.

docker-entrypoint

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ if [[ $SKIP_COMPOSER_UPDATE != "1" ]]; then
1515
composer selfupdate -vvvn
1616
fi
1717

18+
# Enable Xdebug
19+
# Use Xdebug if ENABLE_XDEBUG env is set to 1.
20+
if [[ $ENABLE_XDEBUG == "1" ]]; then
21+
echo -e "\e[32mXdebug enabled\e[0m"
22+
echo "zend_extension = /usr/local/lib/php/extensions/no-debug-non-zts-20160303/xdebug.so" >> /usr/local/lib/php.ini
23+
fi
24+
1825
if [[ $1 == "server" ]]; then
1926
exec honcho -d / start
2027
fi

0 commit comments

Comments
 (0)