Open cmil opened 3 years ago
Adding libexecinfo-dev
to the apk package add list resolves this error and gets the build process through preinstall and install. However, I then received the following error on postinstall:
> aws-lambda-ric@1.1.0 postinstall /home/node/node_modules/aws-lambda-ric
> ./scripts/postinstall.sh
> aws-lambda-ric@1.1.0 build:gyp /home/node/node_modules/aws-lambda-ric
> node-gyp rebuild
gyp ERR! find Python
gyp ERR! find Python Python is not set from command line or npm configuration
gyp ERR! find Python Python is not set from environment variable PYTHON
gyp ERR! find Python checking if "python" can be used
gyp ERR! find Python - "python" is not in PATH or produced an error
gyp ERR! find Python checking if "python2" can be used
gyp ERR! find Python - "python2" is not in PATH or produced an error
gyp ERR! find Python checking if "python3" can be used
gyp ERR! find Python - "python3" is not in PATH or produced an error
gyp ERR! find Python
gyp ERR! find Python **********************************************************
gyp ERR! find Python You need to install the latest version of Python.
gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
gyp ERR! find Python you can try one of the following options:
gyp ERR! find Python - Use the switch --python="/path/to/pythonexecutable"
gyp ERR! find Python (accepted by both node-gyp and npm)
gyp ERR! find Python - Set the environment variable PYTHON
gyp ERR! find Python - Set the npm configuration variable python:
gyp ERR! find Python npm config set python "/path/to/pythonexecutable"
gyp ERR! find Python For more information consult the documentation at:
gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
gyp ERR! find Python **********************************************************
gyp ERR! find Python
gyp ERR! configure error
gyp ERR! stack Error: Could not find any Python installation to use
gyp ERR! stack at PythonFinder.fail (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:307:47)
gyp ERR! stack at PythonFinder.runChecks (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:136:21)
gyp ERR! stack at PythonFinder.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:179:16)
gyp ERR! stack at PythonFinder.execFileCallback (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:271:16)
gyp ERR! stack at exithandler (child_process.js:326:5)
gyp ERR! stack at ChildProcess.errorhandler (child_process.js:338:5)
gyp ERR! stack at ChildProcess.emit (events.js:375:28)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! stack at onErrorNT (internal/child_process.js:467:16)
gyp ERR! stack at processTicksAndRejections (internal/process/task_queues.js:82:21)
gyp ERR! System Linux 5.4.0-74-generic
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
~Is Python actually required for the install?~
EDIT: Python does seem to be an additional, unlisted dependency. Adding python3
to apk add
resolves this final error and allows a successful build. Tested invoking while running the function on local RIE, and my function was successfully called.
This appears to be related to #12. While it isn't reasonable to expect every dependency on every OS to be listed, python is a large, critical dependency that should definitely be listed.
I'm running into similar problems with trying to manually build a Lambda container on Ubuntu:
#12 25.26 configure: WARNING: SSL disabled, you will not be able to use HTTPS, FTPS, NTLM and more.
#12 25.26 configure: WARNING: Use --with-openssl, --with-gnutls, --with-wolfssl, --with-mbedtls, --with-nss, --with-schannel, --with-secure-transport, --with-mesalink, --with-amissl, --with-bearssl or --with-rustls to address this.
#12 25.26 checking for library containing psl_builtin... no
And I have all dependencies installed:
RUN apt update && \
apt install -y build-essential make cmake autoconf automake libtool m4 python3 unzip libssl-dev libcurl4-openssl-dev && \
apt clean && \
rm -rf /tmp/* /var/lib/apt/lists/*
The compilation works when installing this, but a lot of the features like SSL etc are disabled because the scripts and cmake
apparently cannot find the required libraries.
On the final image, I can see SSL installed however:
app@d528ea733c3b:/app$ openssl version
OpenSSL 1.1.1f 31 Mar 2020
So, can we get some feedback from AWS here on how to properly install this? This is my entire Dockerfile:
# Custom Ink NodeJS Lambda Container Image
#
# This Dockerfile builds the Lambda runtime container for Ruby, making sure that all dependencies and
# requirements are met to provide the same functionality that the standard AWS Lambda images provide.
#
# Since this builds upon the standard Ruby Images provided by the Kubernetes platform, there is very
# little work that needs to be outside installing the required tooling and dependencies.
ARG BUILD_VARIANT
ARG UBUNTU_VERSION=20.04
FROM 916869144969.dkr.ecr.us-east-1.amazonaws.com/customink/nodejs:${UBUNTU_VERSION}-${BUILD_VARIANT}
# Because we consumed the argument in the FROM statement, we need to redefine it
# so we can use it inside the Dockerfile, this is a quirk from Docker.
ARG BUILD_VARIANT
# Update the labels of the container for proper information tracking
LABEL description="Custom Ink NodeJS Lambda $BUILD_VARIANT Image"
# Expose the required environment variables
ENV LAMBDA_TASK_ROOT="/app"
# Switch to the root user, as we will need to install packages and dependencies to ensure we can properly build Ruby.
WORKDIR /root
USER root
# Install the requirements needed to be able to install the AWS packages
RUN apt update && \
apt install -y build-essential make cmake autoconf automake libtool m4 python3 unzip libssl-dev libcurl4-openssl-dev && \
apt clean && \
rm -rf /tmp/* /var/lib/apt/lists/*
# Ensure the runtime directory exists
RUN mkdir -p /var/runtime
# Install the AWS Commandline Client, granting the required access to executing things inside the image.
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" \
&& unzip awscliv2.zip \
&& ./aws/install \
&& rm -rf .aws/install \
&& rm awscliv2.zip
# Install the Lambda Runtime Interface Emulator
# We will install this inside the required location to make it detectable by the system
RUN mkdir -p ~/.aws-lambda-rie \
&& curl -Lo "/usr/local/bin/aws-lambda-rie" "https://github.com/aws/aws-lambda-runtime-interface-emulator/releases/latest/download/aws-lambda-rie" \
&& chmod +x "/usr/local/bin/aws-lambda-rie"
# Switch back to the correct user and working directory,
# and ensure that the container is configured correctly.
USER "app"
WORKDIR "/app"
# Install the required gem for the AWS Lambda Runtime Client.
# This will be sourced through NPM.
RUN npm i aws-lambda-ric
ENTRYPOINT ["/usr/bin/npx", "aws-lambda-ric"]
CMD ["app.handler"]
When trying to install
aws-lambda-ric
on a recent Alpine Linux with the following Dockerfilea
docker run
exits with the following error messages in the end:Also see awslabs/aws-lambda-cpp#124.