I want to create a Docker image container that just runs a simple javascript file that just requires one module (aws-sdk
). How can I install just this one module? Can I do it without copying a package.json
file into the docker container?
My Dockerfile looks like this:
FROM node:14
# Install aws-sdk
RUN npm install aws-sdk
WORKDIR /usr/src/app
# Copy the local js script to the working directory in remote container
COPY myScript.ts ./
# The structure now looks like '/usr/src/app/myScript.ts'
ENTRYPOINT ["node", "myScript.ts"]
But when building my Docker container, I get this error:
ERROR: failed to solve: process "/bin/sh -c npm install aws-sdk" did not complete successfully: exit code: 1
New contributor
celenac is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.