Fix xcache example and add example of using docker-php-ext-* with an absolute path

This commit is contained in:
Tianon Gravi 2016-12-10 08:52:07 -08:00
parent 1108636f8d
commit 005da92838
1 changed files with 14 additions and 1 deletions

View File

@ -111,7 +111,7 @@ RUN apt-get update && apt-get install -y libmemcached-dev \
Some extensions are not provided via either Core or PECL; these can be installed too, although the process is less automated:
```dockerfile
FROM php:7.0-apache
FROM php:5.6-apache
RUN curl -fsSL 'https://xcache.lighttpd.net/pub/Releases/3.2.0/xcache-3.2.0.tar.gz' -o xcache.tar.gz \
&& mkdir -p xcache \
&& tar -xf xcache.tar.gz -C xcache --strip-components=1 \
@ -127,6 +127,19 @@ RUN curl -fsSL 'https://xcache.lighttpd.net/pub/Releases/3.2.0/xcache-3.2.0.tar.
&& docker-php-ext-enable xcache
```
The `docker-php-ext-*` scripts *can* accept an arbitrary path, but it must be absolute (to disambiguate from built-in extension names), so the above example could also be written as the following:
```dockerfile
FROM php:5.6-apache
RUN curl -fsSL 'https://xcache.lighttpd.net/pub/Releases/3.2.0/xcache-3.2.0.tar.gz' -o xcache.tar.gz \
&& mkdir -p /tmp/xcache \
&& tar -xf xcache.tar.gz -C /tmp/xcache --strip-components=1 \
&& rm xcache.tar.gz \
&& docker-php-ext-configure /tmp/xcache --enable-xcache \
&& docker-php-ext-install /tmp/xcache \
&& rm -r /tmp/xcache
```
### Without a `Dockerfile`
If you don't want to include a `Dockerfile` in your project, it is sufficient to do the following: