Open
Description
In an attempt to reduce the time it takes to re-package, I'm looking at installing this tool globally (npm install -g aws-lambda-ric
) before my function code it copied into the image to take advantage of dockers caching/layering.
The suggested solution (below) has no way of taking advantage of dockers layering. As we have to endure constant cURL rebuilds...
# Copy function code
RUN mkdir -p ${FUNCTION_DIR}
COPY myFunction/* ${FUNCTION_DIR}
WORKDIR ${FUNCTION_DIR}
# If the dependency is not in package.json uncomment the following line
# RUN npm install aws-lambda-ric
RUN npm install
It would be great to install it globally in its own step. Docker could then cache the cURL build and developers could spend their time doing something productive...
# https://github.com/aws/aws-lambda-nodejs-runtime-interface-client/issues/28
RUN mkdir -p /usr/local/lib/node_modules && \
npm install -g aws-lambda-ric && \
rm -rf \
./deps/curl-*/autom4te.cache \
./deps/curl-*/config.log \
./deps/curl-*/configure \
./deps/curl-*/docs \
./deps/curl-*/projects \
./deps/curl-*/tests \
./deps/curl-*/README
RUN mkdir -p "${FUNCTION_DIR}"
COPY ./build/js "${FUNCTION_DIR}"
However this results in errors from the preinstall scripts:
...
#0 22.38 tar: curl-7.78.0/CMake/OtherTests.cmake: Cannot open: No such file or directory
#0 22.38 tar: curl-7.78.0: Cannot mkdir: Permission denied
...