Page MenuHomeDevCentral

D46.diff
No OneTemporary

D46.diff

diff --git a/Dockerfile b/Dockerfile
new file mode 100644
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,83 @@
+#
+# Nasqueron - Base PHP CLI image
+#
+
+FROM debian:jessie
+MAINTAINER Sébastien Santoro aka Dereckson <dereckson+nasqueron-docker@espace-win.org>
+
+#
+# Prepare the container
+#
+
+ENV PHP_VERSION 5.6.15
+ENV PHP_INI_DIR /usr/local/etc/php
+ENV PHP_BUILD_DEPS bzip2 \
+ file \
+ libbz2-dev \
+ libcurl4-openssl-dev \
+ libjpeg-dev \
+ libmcrypt-dev \
+ libpng12-dev \
+ libreadline6-dev \
+ libssl-dev \
+ libxml2-dev \
+ libreadline-dev \
+ libncursesw5-dev \
+ libnewt-dev
+
+RUN apt-get update && apt-get install -y ca-certificates curl libxml2 autoconf \
+ gcc libc-dev make pkg-config nano less tmux wget git \
+ $PHP_BUILD_DEPS $PHP_EXTRA_BUILD_DEPS \
+ --no-install-recommends && rm -r /var/lib/apt/lists/*
+
+RUN gpg --keyserver pool.sks-keyservers.net --recv-keys 6E4F6AB321FDC07F2C332E3AC2BF0BC433CFC8B3 0BD78B5F97500D450838F95DFE857D9A90D90EC1 \
+ && mkdir -p $PHP_INI_DIR/conf.d \
+ && set -x \
+ && curl -SL "http://php.net/get/php-$PHP_VERSION.tar.bz2/from/this/mirror" -o php.tar.bz2 \
+ && curl -SL "http://php.net/get/php-$PHP_VERSION.tar.bz2.asc/from/this/mirror" -o php.tar.bz2.asc \
+ && gpg --verify php.tar.bz2.asc \
+ && mkdir -p /usr/src/php \
+ && tar -xof php.tar.bz2 -C /usr/src/php --strip-components=1 \
+ && rm php.tar.bz2* \
+ && cd /usr/src/php \
+ && ./configure \
+ --with-config-file-path="$PHP_INI_DIR" \
+ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \
+ $PHP_EXTRA_CONFIGURE_ARGS \
+ --disable-cgi \
+ --enable-mysqlnd \
+ --enable-bcmath \
+ --enable-bz2 \
+ --enable-calendar \
+ --with-curl \
+ --with-gd \
+ --with-jpeg-dir \
+ --enable-gd-native-ttf \
+ --enable-mbstring \
+ --with-mcrypt \
+ --with-mysqli \
+ --with-pdo-mysql \
+ --enable-pcntl \
+ --with-openssl \
+ --with-readline \
+ --with-zlib \
+ --enable-zip \
+ --with-newt \
+ && make -j"$(nproc)" \
+ && make install \
+ && { find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; } \
+ && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false -o APT::AutoRemove::SuggestsImportant=false $buildDeps \
+ && make clean \
+ && pecl install ncurses \
+ && pecl install newt \
+ && cd /opt \
+ && curl -sS https://getcomposer.org/installer | php \
+ && ln -s /opt/composer.phar /usr/local/bin/composer
+
+RUN groupadd -r app -g 433 && \
+ mkdir /home/app && \
+ useradd -u 431 -r -g app -d /home/app -s /bin/sh -c "Default application account" app && \
+ chown -R app:app /home/app && \
+ chmod 711 /home/app
+
+COPY files /
diff --git a/LICENSE b/LICENSE
new file mode 100644
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+Copyright (c) 2015 Sébastien Santoro aka Dereckson
+Copyright (c) 2014-2015 Docker, Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/README.md b/README.md
new file mode 100644
--- /dev/null
+++ b/README.md
@@ -0,0 +1,39 @@
+# PHP CLI
+
+## Description
+
+This image offers a comprehensive CLI PHP environment with newt, readline
+and ncurses extensions available. It's intended to create containers to
+provide a PHP console application.
+
+The last PHP version is compiled through a build process borrowed from
+the official PHP Docker image, with [this Dockerfile used](https://github.com/docker-library/php/blob/08bf31dfd492f02a2696c9a30eb85326b1570abd/5.6/fpm/Dockerfile).
+
+We add common extensions like calendar, curl, gd, iconv, libxml, mbstring,
+mcrypt, mysqli, PDO MySQL and pcntl. The Pear, PECL executables and utilities
+(including build stuff like phpize) are available too.
+
+Once running, you can quickly add PHP extensions to this image,
+with `docker-php-ext-configure` and `docker-php-ext-install` scripts.
+
+## How to use it
+
+To rebuild this image:
+
+ docker build --tag nasqueron/php-cli .
+
+To rebuild a fork of this image based on a modified Dockerfile:
+
+ docker build --tag your-image-name-tag .
+
+To launch a container to execute a PHP application 'quux' in /data/awesome-php-app:
+
+ docker run -it --rm -v /data/awesome-php-app:/opt/app nasqueron/php-cli /opt/app/quux
+
+To create an image for an application with this as base, create a Dockerfile:
+
+ FROM nasqueron/php-cli
+ # Debian commands to deploy your application code
+ CMD ["/path/to/your/app"]
+
+That's it.
diff --git a/files/usr/local/bin/docker-php-ext-configure b/files/usr/local/bin/docker-php-ext-configure
new file mode 100644
--- /dev/null
+++ b/files/usr/local/bin/docker-php-ext-configure
@@ -0,0 +1,19 @@
+#!/bin/bash
+set -e
+
+ext="$1"
+extDir="/usr/src/php/ext/$ext"
+if [ -z "$ext" -o ! -d "$extDir" ]; then
+ echo >&2 "usage: $0 ext-name [configure flags]"
+ echo >&2 " ie: $0 gd --with-jpeg-dir=/usr/local/something"
+ echo >&2
+ echo >&2 'Possible values for ext-name:'
+ echo >&2 $(find /usr/src/php/ext -mindepth 2 -maxdepth 2 -type f -name 'config.m4' | cut -d/ -f6 | sort)
+ exit 1
+fi
+shift
+
+set -x
+cd "$extDir"
+phpize
+./configure "$@"
diff --git a/files/usr/local/bin/docker-php-ext-install b/files/usr/local/bin/docker-php-ext-install
new file mode 100644
--- /dev/null
+++ b/files/usr/local/bin/docker-php-ext-install
@@ -0,0 +1,60 @@
+#!/bin/bash
+set -e
+
+cd /usr/src/php/ext
+
+usage() {
+ echo "usage: $0 ext-name [ext-name ...]"
+ echo " ie: $0 gd mysqli"
+ echo " $0 pdo pdo_mysql"
+ echo
+ echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure'
+ echo
+ echo 'Possible values for ext-name:'
+ echo $(find /usr/src/php/ext -mindepth 2 -maxdepth 2 -type f -name 'config.m4' | cut -d/ -f6 | sort)
+}
+
+exts=()
+while [ $# -gt 0 ]; do
+ ext="$1"
+ shift
+ if [ -z "$ext" ]; then
+ continue
+ fi
+ if [ ! -d "$ext" ]; then
+ echo >&2 "error: $(pwd -P)/$ext does not exist"
+ echo >&2
+ usage >&2
+ exit 1
+ fi
+ exts+=( "$ext" )
+done
+
+if [ "${#exts[@]}" -eq 0 ]; then
+ usage >&2
+ exit 1
+fi
+
+for ext in "${exts[@]}"; do
+ (
+ cd "$ext"
+ [ -e Makefile ] || docker-php-ext-configure "$ext"
+ make
+ make install
+ ini="/usr/local/etc/php/conf.d/docker-php-ext-$ext.ini"
+ for module in modules/*.so; do
+ if [ -f "$module" ]; then
+ if grep -q zend_extension_entry "$module"; then
+ # https://wiki.php.net/internals/extensions#loading_zend_extensions
+ line="zend_extension=$(basename "$module")"
+ else
+ line="extension=$(basename "$module")"
+ fi
+ if ! grep -q "$line" "$ini"; then
+ echo "$line" >> "/usr/local/etc/php/conf.d/ext-$ext.ini"
+ fi
+ fi
+ done
+ make clean
+ )
+done
diff --git a/files/usr/local/etc/php/conf.d/date.ini b/files/usr/local/etc/php/conf.d/date.ini
new file mode 100644
--- /dev/null
+++ b/files/usr/local/etc/php/conf.d/date.ini
@@ -0,0 +1,4 @@
+[date]
+date.timezone = UTC
+date.default_latitude = 50.37
+date.default_longitude = 4.49
diff --git a/files/usr/local/etc/php/conf.d/ncurses.ini b/files/usr/local/etc/php/conf.d/ncurses.ini
new file mode 100644
--- /dev/null
+++ b/files/usr/local/etc/php/conf.d/ncurses.ini
@@ -0,0 +1 @@
+extension=ncurses.so
diff --git a/files/usr/local/etc/php/conf.d/newt.ini b/files/usr/local/etc/php/conf.d/newt.ini
new file mode 100644
--- /dev/null
+++ b/files/usr/local/etc/php/conf.d/newt.ini
@@ -0,0 +1 @@
+extension=newt.so
diff --git a/files/usr/local/etc/php/conf.d/opcache.ini b/files/usr/local/etc/php/conf.d/opcache.ini
new file mode 100644
--- /dev/null
+++ b/files/usr/local/etc/php/conf.d/opcache.ini
@@ -0,0 +1,3 @@
+zend_extension=opcache.so
+opcache.enable=On
+opcache.validate_timestamps=0

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 16, 15:35 (22 h, 14 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2247720
Default Alt Text
D46.diff (8 KB)

Event Timeline