forked from brefphp/extra-php-extensions
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add memcache extension layer (brefphp#5)
* add memcache extension * include patch file * Make sure we install memcached too Co-authored-by: Tobias Nyholm <[email protected]>
- Loading branch information
Showing
3 changed files
with
76 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,4 +37,4 @@ layers: docker-images | |
|
||
publish: layers | ||
php ./bref-extra publish | ||
php ./bref-extra list | ||
php ./bref-extra list |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
ARG PHP_VERSION | ||
FROM bref/build-php-$PHP_VERSION as ext | ||
|
||
ENV LIBMEMCACHED_BUILD_DIR=${BUILD_DIR}/libmemcached | ||
|
||
RUN set -xe; \ | ||
mkdir -p ${LIBMEMCACHED_BUILD_DIR}; \ | ||
# Download and upack the source code | ||
curl -Ls https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz \ | ||
| tar xzC ${LIBMEMCACHED_BUILD_DIR} | ||
|
||
# patch from https://src.fedoraproject.org/rpms/libmemcached/raw/HEAD/f/libmemcached-build.patch for build with GCC7 | ||
COPY libmemcached-build.patch ${LIBMEMCACHED_BUILD_DIR}/libmemcached-1.0.18/libmemcached-build.patch | ||
|
||
# Move into the unpackaged code directory | ||
WORKDIR ${LIBMEMCACHED_BUILD_DIR}/libmemcached-1.0.18/ | ||
|
||
# Install | ||
RUN set -xe; \ | ||
patch -d . -p0 < libmemcached-build.patch && \ | ||
./configure --prefix=${INSTALL_DIR} && \ | ||
make && \ | ||
make install | ||
|
||
RUN pecl install memcache | ||
RUN cp /opt/bref/lib/php/extensions/no-debug-zts-*/memcache.so /tmp/memcache.so | ||
|
||
RUN pecl install --onlyreqdeps --nobuild memcached && \ | ||
cd "$(pecl config-get temp_dir)/memcached" && \ | ||
phpize && \ | ||
./configure --with-libmemcached-dir=${INSTALL_DIR} --disable-memcached-sasl && \ | ||
make && \ | ||
make install && \ | ||
cd - | ||
|
||
RUN cp /opt/bref/lib/php/extensions/no-debug-zts-*/memcached.so /tmp/memcached.so | ||
|
||
# Build the final image from the lambci image that is close to the production environment | ||
FROM lambci/lambda:provided | ||
|
||
# Copy things we installed to the final image | ||
COPY --from=ext /opt/bref/include/libmemcached/ /opt/bref/include/libmemcached/ | ||
COPY --from=ext /opt/bref/include/libmemcached-1.0/ /opt/bref/include/libmemcached-1.0/ | ||
COPY --from=ext /opt/bref/include/libmemcachedutil-1.0/ /opt/bref/include/libmemcachedutil-1.0/ | ||
COPY --from=ext /opt/bref/include/libhashkit/ /opt/bref/include/libhashkit/ | ||
COPY --from=ext /opt/bref/include/libhashkit-1.0/ /opt/bref/include/libhashkit-1.0/ | ||
|
||
COPY --from=ext /opt/bref/lib/libhashkit.* /opt/bref/lib/ | ||
COPY --from=ext /opt/bref/lib/libmemcached.* /opt/bref/lib/ | ||
COPY --from=ext /opt/bref/lib/libmemcachedutil.* /opt/bref/lib/ | ||
COPY --from=ext /opt/bref/lib/pkgconfig/libmemcached.pc /opt/bref/lib/pkgconfig/libmemcached.pc | ||
|
||
COPY --from=ext /tmp/memcache.so /opt/bref-extra/memcache.so | ||
COPY --from=ext /tmp/memcached.so /opt/bref-extra/memcached.so |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
diff -up ./clients/memflush.cc.old ./clients/memflush.cc | ||
--- ./clients/memflush.cc.old 2017-02-12 10:12:59.615209225 +0100 | ||
+++ ./clients/memflush.cc 2017-02-12 10:13:39.998382783 +0100 | ||
@@ -39,7 +39,7 @@ int main(int argc, char *argv[]) | ||
{ | ||
options_parse(argc, argv); | ||
|
||
- if (opt_servers == false) | ||
+ if (!opt_servers) | ||
{ | ||
char *temp; | ||
|
||
@@ -48,7 +48,7 @@ int main(int argc, char *argv[]) | ||
opt_servers= strdup(temp); | ||
} | ||
|
||
- if (opt_servers == false) | ||
+ if (!opt_servers) | ||
{ | ||
std::cerr << "No Servers provided" << std::endl; | ||
exit(EXIT_FAILURE); |