I've build a NodeJS project, which I need to run on a custom Docker image.
This is my Dockerfile:
FROM public.ecr.aws/lambda/nodejs:14-x86_64
# Create app directory
WORKDIR /usr/src/
RUN yum update && yum install -y git openssh-client vim python py-pip pip jq
RUN yum update && yum install -y automake autoconf libtool dpkg pkgconfig nasm libpng cmake
RUN pip install awscli
# RUN apk --purge -v del py-pip
# RUN rm /var/cache/apk/*
RUN npm install -g yarn
RUN yarn install --frozen-lockfile
# Bundle app source
COPY . .
RUN yarn build
ENTRYPOINT ["npx", "aws-lambda-ric"]
CMD [ "src/executionHandler.runner" ]
But when I call docker run <imagename>
I get the following errors:
tar: curl-7.78.0/tests/data/test1131: Cannot open: No such file or directory
tar: curl-7.78.0: Cannot mkdir: Permission denied
tar: curl-7.78.0/tests/data/test971: Cannot open: No such file or directory
tar: curl-7.78.0: Cannot mkdir: Permission denied
tar: Exiting with failure status due to previous errors
./scripts/preinstall.sh: line 28: cd: curl-7.78.0: No such file or directory
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] preinstall: `./scripts/preinstall.sh`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] preinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2021-10-13T09_11_31_626Z-debug.log
Install for [ 'aws-lambda-ric@latest' ] failed with code 1
The base image I use was taken from official AWS images repository.
How can I resolve this permissions issue?
You do not need to specify entrypoint at all for prebuild lambda docker image, just:
CMD [ "src/executionHandler.runner" ]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With