Skip to content

Commit c8b6b84

Browse files
Jens SchulzeNyholm
andcommitted
Add memcache extension layer (#5)
* add memcache extension * include patch file * Make sure we install memcached too Co-authored-by: Tobias Nyholm <[email protected]>
1 parent 53d807b commit c8b6b84

File tree

3 files changed

+76
-1
lines changed

3 files changed

+76
-1
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ layers: docker-images
3737

3838
publish: layers
3939
php ./bref-extra publish
40-
php ./bref-extra list
40+
php ./bref-extra list

layers/memcached/Dockerfile

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
ARG PHP_VERSION
2+
FROM bref/build-php-$PHP_VERSION as ext
3+
4+
ENV LIBMEMCACHED_BUILD_DIR=${BUILD_DIR}/libmemcached
5+
6+
RUN set -xe; \
7+
mkdir -p ${LIBMEMCACHED_BUILD_DIR}; \
8+
# Download and upack the source code
9+
curl -Ls https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz \
10+
| tar xzC ${LIBMEMCACHED_BUILD_DIR}
11+
12+
# patch from https://src.fedoraproject.org/rpms/libmemcached/raw/HEAD/f/libmemcached-build.patch for build with GCC7
13+
COPY libmemcached-build.patch ${LIBMEMCACHED_BUILD_DIR}/libmemcached-1.0.18/libmemcached-build.patch
14+
15+
# Move into the unpackaged code directory
16+
WORKDIR ${LIBMEMCACHED_BUILD_DIR}/libmemcached-1.0.18/
17+
18+
# Install
19+
RUN set -xe; \
20+
patch -d . -p0 < libmemcached-build.patch && \
21+
./configure --prefix=${INSTALL_DIR} && \
22+
make && \
23+
make install
24+
25+
RUN pecl install memcache
26+
RUN cp /opt/bref/lib/php/extensions/no-debug-zts-*/memcache.so /tmp/memcache.so
27+
28+
RUN pecl install --onlyreqdeps --nobuild memcached && \
29+
cd "$(pecl config-get temp_dir)/memcached" && \
30+
phpize && \
31+
./configure --with-libmemcached-dir=${INSTALL_DIR} --disable-memcached-sasl && \
32+
make && \
33+
make install && \
34+
cd -
35+
36+
RUN cp /opt/bref/lib/php/extensions/no-debug-zts-*/memcached.so /tmp/memcached.so
37+
38+
# Build the final image from the lambci image that is close to the production environment
39+
FROM lambci/lambda:provided
40+
41+
# Copy things we installed to the final image
42+
COPY --from=ext /opt/bref/include/libmemcached/ /opt/bref/include/libmemcached/
43+
COPY --from=ext /opt/bref/include/libmemcached-1.0/ /opt/bref/include/libmemcached-1.0/
44+
COPY --from=ext /opt/bref/include/libmemcachedutil-1.0/ /opt/bref/include/libmemcachedutil-1.0/
45+
COPY --from=ext /opt/bref/include/libhashkit/ /opt/bref/include/libhashkit/
46+
COPY --from=ext /opt/bref/include/libhashkit-1.0/ /opt/bref/include/libhashkit-1.0/
47+
48+
COPY --from=ext /opt/bref/lib/libhashkit.* /opt/bref/lib/
49+
COPY --from=ext /opt/bref/lib/libmemcached.* /opt/bref/lib/
50+
COPY --from=ext /opt/bref/lib/libmemcachedutil.* /opt/bref/lib/
51+
COPY --from=ext /opt/bref/lib/pkgconfig/libmemcached.pc /opt/bref/lib/pkgconfig/libmemcached.pc
52+
53+
COPY --from=ext /tmp/memcache.so /opt/bref-extra/memcache.so
54+
COPY --from=ext /tmp/memcached.so /opt/bref-extra/memcached.so
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
diff -up ./clients/memflush.cc.old ./clients/memflush.cc
2+
--- ./clients/memflush.cc.old 2017-02-12 10:12:59.615209225 +0100
3+
+++ ./clients/memflush.cc 2017-02-12 10:13:39.998382783 +0100
4+
@@ -39,7 +39,7 @@ int main(int argc, char *argv[])
5+
{
6+
options_parse(argc, argv);
7+
8+
- if (opt_servers == false)
9+
+ if (!opt_servers)
10+
{
11+
char *temp;
12+
13+
@@ -48,7 +48,7 @@ int main(int argc, char *argv[])
14+
opt_servers= strdup(temp);
15+
}
16+
17+
- if (opt_servers == false)
18+
+ if (!opt_servers)
19+
{
20+
std::cerr << "No Servers provided" << std::endl;
21+
exit(EXIT_FAILURE);

0 commit comments

Comments
 (0)