Skip to content

Commit

Permalink
Merge pull request #7 from rtucek/release/v0.3.0
Browse files Browse the repository at this point in the history
Release/v0.3.0

- Add Travis CI - #1
- Add Xdebug - #2
  • Loading branch information
rtucek committed Dec 31, 2016
2 parents 9bf5bcc + e498ecd commit 515818d
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 2 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.editorconfig
.travis.yml
CHANGELOG.md
LICENSE
Makefile
Expand Down
12 changes: 12 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
sudo: false

services:
- docker

addons:
apt:
packages:
- make

script:
- make test-build
17 changes: 16 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ FROM debian:jessie

ENV \
NGINX_VERSION=1.11.8 \
PHP_VERSION=7.1.0
PHP_VERSION=7.1.0 \
XDEBUG_VERSION=2.5.0

COPY \
docker-entrypoint \
Expand All @@ -16,6 +17,7 @@ RUN \
apt-get update && \
apt-get install -y --no-install-recommends \
# In general...
autoconf \
build-essential \
curl \

Expand Down Expand Up @@ -152,6 +154,18 @@ RUN \
make -j$(nproc) build && \
make install && \

# Compile Xdebug
mkdir -p /tmp/build/xdebug && \
cd /tmp/build/xdebug && \
curl -SLO \
"https://github.com/xdebug/xdebug/archive/XDEBUG_"$(echo ${XDEBUG_VERSION} | sed "s/\./_/g")".tar.gz" && \
tar -xvzf "XDEBUG_"$(echo ${XDEBUG_VERSION} | sed "s/\./_/g")".tar.gz" && \
cd "xdebug-XDEBUG_"$(echo ${XDEBUG_VERSION} | sed "s/\./_/g") && \
phpize && \
./configure && \
make && \
make install && \

# Fix permissions
chown -R www-data:www-data /usr/local/nginx/html && \

Expand Down Expand Up @@ -206,6 +220,7 @@ RUN \

# Final cleanup
apt-get remove -y \
autoconf \
bison \
build-essential \
curl \
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ default: build

build:
docker build -t $(IMAGE_FQN) .

test-build:
docker build -t testbuild .
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![](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")
[![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")

## nginx-php Dockerfile

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

Xdebug is installed as shared extension, but not activated. Start the container with env
ENABLE_XDEBUG=1 to enable the extension.

The Nginx and PHP-FPM master processes are controlled by [Honcho](https://github.com/nickstenning/honcho).
Honcho was chosen over Supervisor, because honcho will exit and kill the container if either Nginx
or PHP's master process dye for any reason. If you want have to have the container restarted
Expand Down Expand Up @@ -42,6 +45,12 @@ Mount your custom `nginx.conf` file at `/usr/local/nginx/conf/nginx.conf`.
* Mount your custom `www.conf` file at `/usr/local/etc/www.conf`.
* Mount your custom `php.ini` file at `/usr/local/php/php.ini`.

### Xdebug

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

### Honcho

If you want to overwrite the default Honcho configuration - mount your custom `Procfile` file at `/`.
Expand Down
7 changes: 7 additions & 0 deletions docker-entrypoint
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ if [[ $SKIP_COMPOSER_UPDATE != "1" ]]; then
composer selfupdate -vvvn
fi

# Enable Xdebug
# Use Xdebug if ENABLE_XDEBUG env is set to 1.
if [[ $ENABLE_XDEBUG == "1" ]]; then
echo -e "\e[32mXdebug enabled\e[0m"
echo "zend_extension = /usr/local/lib/php/extensions/no-debug-non-zts-20160303/xdebug.so" >> /usr/local/lib/php.ini
fi

if [[ $1 == "server" ]]; then
exec honcho -d / start
fi
Expand Down

0 comments on commit 515818d

Please sign in to comment.