New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dockerfile: no longer require package-lock #29
Conversation
# Copy package.json, and optionally package-lock.json if it exists | ||
COPY package.json package-lock.json* ./ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The final npm start
command in the Dockerfile
relies on a package.json
existing. This copy command means we fail early if it doesn't.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume the * at the end is what gets us the does not fail if package-lock.json does not exist but it would copy over package-lock.json2 etc. as well. We might be able to tighten that up but I don't think that is a blocker for this PR.
RUN \ | ||
if [ -f package-lock.json ]; then npm ci; \ | ||
else npm install; \ | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fallback in case of no package-lock.json
. It's unusual for a Node.js project repository to not have one these days, but let's cater for the exception.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
dockerfile: no longer require package-lock (nodeshift-starters#29)
We want the DevFile to work for as many applications as possible out of the box, so this adds a fallback for the case a project does not have a
package-lock.json