aws/aws-lambda-nodejs-runtime-interface-client

v3.3.0 does not install in docker

Closed this issue · 3 comments

Using v3.3.0 in docker build process.
The build occurs for the first time, but if building on the same machine again, the installation never completes.

Image
# Define custom function directory
ARG FUNCTION_DIR="/function"

FROM node:20-buster as build-image

# Include global arg in this stage of the build
ARG FUNCTION_DIR

# Install build dependencies
RUN apt-get update && \
    apt-get install -y \
    g++ \
    make \
    cmake \
    unzip \
    libcurl4-openssl-dev

# Copy function code
RUN mkdir -p ${FUNCTION_DIR}
COPY . ${FUNCTION_DIR}

WORKDIR ${FUNCTION_DIR}

# Install Node.js dependencies
RUN npm install

# Grab a fresh slim copy of the image to reduce the final size
FROM node:20-buster-slim

# Required for Node runtimes which use npm@8.6.0+ because
# by default npm writes logs under /home/.npm and Lambda fs is read-only
ENV NPM_CONFIG_CACHE=/tmp/.npm

# Include global arg in this stage of the build
ARG FUNCTION_DIR

# Set working directory to function root directory
WORKDIR ${FUNCTION_DIR}

# Copy in the built dependencies
COPY --from=build-image ${FUNCTION_DIR} ${FUNCTION_DIR}

RUN apt-get update && apt-get install -y \
    php \
    php-cli \
    unzip \
    curl \
 && apt-get clean \
 && rm -rf /var/lib/apt/lists/*

COPY app.js ${FUNCTION_DIR}
COPY php-script.php ${FUNCTION_DIR}

# Set runtime interface client as default command for the container runtime
ENTRYPOINT ["/usr/local/bin/npx", "aws-lambda-ric"]
# Pass the name of the function handler as an argument to the runtime
CMD ["app.handler"]

The build works for the first time but not on subsequent builds.
Tried on local, remote servers as well as GH runner.
Issue persists irrespective of how the package is installed, via package.json file or directly in docker via RUN npm install aws-lambda-ric

Image

Gets stuck while running the preinstall script
#14 25.64 npm info run aws-lambda-ric@3.3.0 preinstall node_modules/aws-lambda-ric ./scripts/preinstall.sh

The issue occurs when building with --platform linux/arm64 on a GitHub runner that runs on AMD64.
Changed GH runner to arm64, and the issue is resolved.