Skip to content

Commit

Permalink
Added new amqp layer with supported libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
Nyholm committed Dec 20, 2019
1 parent 6838a5c commit de78a90
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ layers: docker-images
rm -rf export/tmp

publish: layers
php src/publish.php
php ./bref-extra publish
2 changes: 1 addition & 1 deletion checksums.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"amqp-php-73":"e465b47dcaf40a1adb05ae03b790d86e"}
{"amqp-php-73":"6e5ec38cfaf51de0353c1b9e459ea001"}
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ class ServerlessPlugin {
const region = serverless.getProvider('aws').getRegion();
const layerName = variableString.substr('bref:extra.'.length);
if (! (layerName in layers)) {
throw `Unknown Bref layer named "${layerName}"`;
throw `Unknown Bref extra layer named "${layerName}"`;
}
if (! (region in layers[layerName])) {
throw `There is no Bref layer named "${layerName}" in region "${region}"`;
throw `There is no Bref extra layer named "${layerName}" in region "${region}"`;
}
const version = layers[layerName][region];
return `arn:aws:lambda:${region}:209497400698:layer:${layerName}:${version}`;
return `arn:aws:lambda:${region}:403367587399:layer:${layerName}:${version}`;
}

return delegate(variableString);
Expand Down
20 changes: 16 additions & 4 deletions layers/amqp/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG PHP_VERSION
FROM bref/build-php-$PHP_VERSION
FROM bref/build-php-$PHP_VERSION as amqp

ENV LIBRABBITMQ_BUILD_DIR=${BUILD_DIR}/librabbitmq

Expand All @@ -9,11 +9,10 @@ RUN set -xe; \
curl -Ls https://github.com/alanxz/rabbitmq-c/archive/v0.9.0.tar.gz \
| tar xzC ${LIBRABBITMQ_BUILD_DIR}

RUN echo ${LIBRABBITMQ_BUILD_DIR}
# Move into the unpackaged code directory
WORKDIR ${LIBRABBITMQ_BUILD_DIR}/rabbitmq-c-0.9.0/

# Install"
# Install
RUN set -xe; \
cmake -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} . && \
cmake --build . --target install
Expand All @@ -22,4 +21,17 @@ RUN pecl install amqp

# Build the final image from the lambci image that is close to the production environment
FROM lambci/lambda:provided
COPY --from=0 /opt/bref/lib/php/extensions/no-debug-zts-20180731/amqp.so /opt/bref-aqmp/amqp.so

# Copy things we installed to the final image
COPY --from=amqp /opt/bref/include/amqp.h /opt/bref/include/amqp.h
COPY --from=amqp /opt/bref/include/amqp_framing.h /opt/bref/include/amqp_framing.h
COPY --from=amqp /opt/bref/include/amqp_ssl_socket.h /opt/bref/include/amqp_ssl_socket.h
COPY --from=amqp /opt/bref/include/amqp_tcp_socket.h /opt/bref/include/amqp_tcp_socket.h

COPY --from=amqp /opt/bref/lib64/librabbitmq.a /opt/bref/lib64/librabbitmq.a
COPY --from=amqp /opt/bref/lib64/librabbitmq.so /opt/bref/lib64/librabbitmq.so
COPY --from=amqp /opt/bref/lib64/librabbitmq.so.4 /opt/bref/lib64/librabbitmq.so.4
COPY --from=amqp /opt/bref/lib64/librabbitmq.so.4.3.0 /opt/bref/lib64/librabbitmq.so.4.3.0
COPY --from=amqp /opt/bref/lib64/pkgconfig/librabbitmq.pc /opt/bref/lib64/pkgconfig/librabbitmq.pc

COPY --from=amqp /opt/bref/lib/php/extensions/no-debug-zts-20180731/amqp.so /opt/bref/lib/php/extensions/no-debug-zts-20180731/amqp.so

0 comments on commit de78a90

Please sign in to comment.