diff --git a/Dockerfile b/Dockerfile index 7ded650..3d6bdf7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM lsiobase/alpine:3.5 +FROM lsiobase/alpine:3.6 MAINTAINER sparklyballs # set version label @@ -6,14 +6,35 @@ ARG BUILD_DATE ARG VERSION LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}" -# install packages +# copy patches +COPY patches/ /tmp/patches/ + +# package versions +ARG APCU_VER="4.0.11" +ARG MEMCACHE_VER="3.0.8" +ARG XCACHE_VER="3.2.0" + +# install build packages RUN \ + apk add --no-cache --virtual=build-dependencies \ + autoconf \ + automake \ + bison \ + file \ + flex \ + g++ \ + gawk \ + gcc \ + make \ + php5-dev \ + zlib-dev && \ + +# install runtime packages apk add --no-cache \ apache2 \ apache2-utils \ curl \ php5-apache2 \ - php5-apcu \ php5-bcmath \ php5-bz2 \ php5-cli \ @@ -26,7 +47,6 @@ RUN \ php5-iconv \ php5-json \ php5-mcrypt \ - php5-memcache \ php5-mssql \ php5-mysql \ php5-odbc \ @@ -37,14 +57,15 @@ RUN \ php5-pdo_odbc \ php5-phar \ php5-soap \ - php5-xcache \ php5-xmlreader \ php5-xmlrpc \ php5-zip \ + re2c \ tar \ wget && \ -# configure apache2 +# configure php and apache2 + ln -sf /usr/bin/php5 /usr/bin/php && \ sed -i \ -e 's#User apache#User abc#g' \ -e 's#Group apache#Group abc#g' \ @@ -53,10 +74,70 @@ RUN \ /etc/apache2/httpd.conf && \ sed -i 's#PidFile "/run/.*#Pidfile "/var/run/apache2/httpd.pid"#g' /etc/apache2/conf.d/mpm.conf && \ +# compile php5-apcu + mkdir -p \ + /tmp/apcu-src && \ + curl -o \ + /tmp/apcu.tgz -L \ + "http://pecl.php.net/get/apcu-${APCU_VER}.tgz" && \ + tar xf \ + /tmp/apcu.tgz -C \ + /tmp/apcu-src --strip-components=1 && \ + cd /tmp/apcu-src && \ + phpize5 && \ + ./configure \ + --prefix=/usr \ + --with-php-config=/usr/bin/php-config5 && \ + make && \ + make install && \ + echo "extension=apcu.so" > /etc/php5/conf.d/apcu.ini && \ + +# compile php5-memcache + mkdir -p \ + /tmp/memcache-src && \ + curl -o \ + /tmp/memcache.tgz -L \ + "http://pecl.php.net/get/memcache-${MEMCACHE_VER}.tgz" && \ + tar xf \ + /tmp/memcache.tgz -C \ + /tmp/memcache-src --strip-components=1 && \ + cd /tmp/memcache-src && \ + patch -p1 -i /tmp/patches/memcache-faulty-inline.patch && \ + phpize5 && \ + ./configure \ + --prefix=/usr \ + --with-php-config=/usr/bin/php-config5 && \ + make && \ + make install && \ + echo "extension=memcache.so" > /etc/php5/conf.d/memcache.ini && \ + +# compile php5-xcache + mkdir -p \ + /tmp/xcache-src && \ + curl -o \ + /tmp/xcache.tar.gz -L \ + "http://xcache.lighttpd.net/pub/Releases/${XCACHE_VER}/xcache-${XCACHE_VER}.tar.gz" && \ + tar xf \ + /tmp/xcache.tar.gz -C \ + /tmp/xcache-src --strip-components=1 && \ + cd /tmp/xcache-src && \ + phpize5 --clean && \ + phpize5 && \ +./configure \ + --enable-xcache \ + --enable-xcache-constant \ + --enable-xcache-coverager \ + --enable-xcache-optimizer \ + --prefix=/usr \ + --with-php-config=/usr/bin/php-config5 && \ + make && \ + make install && \ + install -Dm644 /tmp/patches/xcache.ini /etc/php5/conf.d/xcache.ini && \ + # install projectsend rm /var/www/localhost/htdocs/index.html && \ curl -o \ - tmp/ProjectSend.tar.gz -L \ + /tmp/ProjectSend.tar.gz -L \ "https://codeload.github.com/ignacionelson/ProjectSend/tar.gz/r756" && \ tar -zxf \ /tmp/ProjectSend.tar.gz --strip-components=1 -C /var/www/localhost/htdocs/ && \ @@ -65,6 +146,8 @@ RUN \ cp /var/www/localhost/htdocs/includes/sys.config.sample.php /defaults/sys.config.php && \ # cleanup + apk del --purge \ + build-dependencies && \ rm -rf \ /tmp/* diff --git a/patches/memcache-faulty-inline.patch b/patches/memcache-faulty-inline.patch new file mode 100644 index 0000000..b260d02 --- /dev/null +++ b/patches/memcache-faulty-inline.patch @@ -0,0 +1,141 @@ +diff -ru a/memcache_pool.c b/memcache_pool.c +--- a/memcache_pool.c ++++ b/memcache_pool.c +@@ -40,7 +40,7 @@ + + ZEND_DECLARE_MODULE_GLOBALS(memcache) + +-inline void mmc_buffer_alloc(mmc_buffer_t *buffer, unsigned int size) /* ++void mmc_buffer_alloc(mmc_buffer_t *buffer, unsigned int size) /* + ensures space for an additional size bytes {{{ */ + { + register size_t newlen; +@@ -48,7 +48,7 @@ + } + /* }}} */ + +-inline void mmc_buffer_free(mmc_buffer_t *buffer) /* {{{ */ ++void mmc_buffer_free(mmc_buffer_t *buffer) /* {{{ */ + { + if (buffer->value.c != NULL) { + smart_str_free(&(buffer->value)); +@@ -1677,7 +1677,7 @@ + } + /* }}} */ + +-inline int mmc_prepare_key_ex(const char *key, unsigned int key_len, char *result, unsigned int *result_len) /* {{{ */ ++int mmc_prepare_key_ex(const char *key, unsigned int key_len, char *result, unsigned int *result_len) /* {{{ */ + { + unsigned int i; + if (key_len == 0) { +@@ -1695,7 +1695,7 @@ + } + /* }}} */ + +-inline int mmc_prepare_key(zval *key, char *result, unsigned int *result_len) /* {{{ */ ++int mmc_prepare_key(zval *key, char *result, unsigned int *result_len) /* {{{ */ + { + if (Z_TYPE_P(key) == IS_STRING) { + return mmc_prepare_key_ex(Z_STRVAL_P(key), Z_STRLEN_P(key), result, result_len); +diff -ru a/memcache_pool.h b/memcache_pool.h +--- a/memcache_pool.h ++++ b/memcache_pool.h +@@ -129,8 +129,8 @@ + #define mmc_buffer_release(b) memset((b), 0, sizeof(*(b))) + #define mmc_buffer_reset(b) (b)->value.len = (b)->idx = 0 + +-inline void mmc_buffer_alloc(mmc_buffer_t *, unsigned int); +-inline void mmc_buffer_free(mmc_buffer_t *); ++void mmc_buffer_alloc(mmc_buffer_t *, unsigned int); ++void mmc_buffer_free(mmc_buffer_t *); + + /* stream handlers */ + typedef struct mmc_stream mmc_stream_t; +@@ -385,8 +385,8 @@ + double timeval_to_double(struct timeval tv); + struct timeval double_to_timeval(double sec); + +-inline int mmc_prepare_key_ex(const char *, unsigned int, char *, unsigned int *); +-inline int mmc_prepare_key(zval *, char *, unsigned int *); ++int mmc_prepare_key_ex(const char *, unsigned int, char *, unsigned int *); ++int mmc_prepare_key(zval *, char *, unsigned int *); + + #define mmc_str_left(h, n, hlen, nlen) ((hlen) >= (nlen) ? memcmp((h), (n), (nlen)) == 0 : 0) + +diff -ru a/memcache_queue.c b/memcache_queue.c +--- a/memcache_queue.c ++++ b/memcache_queue.c +@@ -26,7 +26,7 @@ + #include "php.h" + #include "memcache_queue.h" + +-MMC_QUEUE_INLINE void mmc_queue_push(mmc_queue_t *queue, void *ptr) { ++void mmc_queue_push(mmc_queue_t *queue, void *ptr) { + if (mmc_queue_contains(queue, ptr)) return; + + if (queue->len >= queue->alloc) { +@@ -53,7 +53,7 @@ + queue->len++; + } + +-MMC_QUEUE_INLINE void *mmc_queue_pop(mmc_queue_t *queue) { ++void *mmc_queue_pop(mmc_queue_t *queue) { + if (queue->len) { + void *ptr; + +@@ -73,7 +73,7 @@ + return NULL; + } + +-MMC_QUEUE_INLINE int mmc_queue_contains(mmc_queue_t *queue, void *ptr) { ++int mmc_queue_contains(mmc_queue_t *queue, void *ptr) { + if (queue != NULL) { + int i; + +@@ -87,14 +87,14 @@ + return 0; + } + +-MMC_QUEUE_INLINE void mmc_queue_free(mmc_queue_t *queue) { ++void mmc_queue_free(mmc_queue_t *queue) { + if (queue->items != NULL) { + efree(queue->items); + } + memset(queue, 0, sizeof(*queue)); + } + +-MMC_QUEUE_INLINE void mmc_queue_copy(mmc_queue_t *target, mmc_queue_t *source) { ++void mmc_queue_copy(mmc_queue_t *target, mmc_queue_t *source) { + if (target->alloc != source->alloc) { + target->alloc = source->alloc; + target->items = erealloc(target->items, sizeof(*target->items) * target->alloc); +@@ -106,7 +106,7 @@ + target->len = source->len; + } + +-MMC_QUEUE_INLINE void mmc_queue_remove(mmc_queue_t *queue, void *ptr) { ++void mmc_queue_remove(mmc_queue_t *queue, void *ptr) { + void *item; + mmc_queue_t original = *queue; + mmc_queue_release(queue); +diff -ru a/memcache_queue.h b/memcache_queue.h +--- a/memcache_queue.h ++++ b/memcache_queue.h +@@ -43,12 +43,12 @@ + #define MMC_QUEUE_INLINE inline + #endif + +-MMC_QUEUE_INLINE void mmc_queue_push(mmc_queue_t *, void *); +-MMC_QUEUE_INLINE void *mmc_queue_pop(mmc_queue_t *); +-MMC_QUEUE_INLINE int mmc_queue_contains(mmc_queue_t *, void *); +-MMC_QUEUE_INLINE void mmc_queue_free(mmc_queue_t *); +-MMC_QUEUE_INLINE void mmc_queue_copy(mmc_queue_t *, mmc_queue_t *); +-MMC_QUEUE_INLINE void mmc_queue_remove(mmc_queue_t *, void *); ++extern void mmc_queue_push(mmc_queue_t *, void *); ++extern void *mmc_queue_pop(mmc_queue_t *); ++extern int mmc_queue_contains(mmc_queue_t *, void *); ++extern void mmc_queue_free(mmc_queue_t *); ++extern void mmc_queue_copy(mmc_queue_t *, mmc_queue_t *); ++extern void mmc_queue_remove(mmc_queue_t *, void *); + + #endif /*MEMCACHE_QUEUE_H_*/ diff --git a/patches/xcache.ini b/patches/xcache.ini new file mode 100644 index 0000000..b814dbc --- /dev/null +++ b/patches/xcache.ini @@ -0,0 +1,3 @@ +;extension=xcache.so +xcache.size=64M +xcache.var_size=64M