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
docker.mdx: use --omit=dev
for npm over deprecated --production
#8226
Conversation
…ion` This fixes npm warnings that I get using the template: ``` [linux/arm64 build-deps 1/1] RUN npm install --production=false npm WARN config production Use `--omit=dev` instead. RUN npm install --production npm WARN config production Use `--omit=dev` instead. ```
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
--omit=dev
for npm instead of deprecated `--product…--omit=dev
for npm over deprecated --production
Hello! Thank you for opening your first PR to Astro’s Docs! 🎉 Here’s what will happen next:
|
Lunaria Status Overview🌕 This pull request will trigger status changes. Learn moreBy default, every PR changing files present in the Lunaria configuration's You can change this by adding one of the keywords present in the Tracked Files
Warnings reference
|
|
||
FROM base AS build-deps | ||
RUN npm install --production=false | ||
RUN npm install | ||
|
||
FROM build-deps AS build | ||
COPY . . |
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.
Niptick: While it works, I would instead specify the intended folders to copy. This solution heavily relies on .dockerignore
being correct and not allowing anything unwanted to be copied.
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.
Suggestion/Nitpick: While .
works fine, perhaps /app/
would convey more information without relying on the previous state of the WORKDIR
.
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.
it's different working styles, I guess the doc purpose is only to convey examples, it's hard to cover all use cases, and sometimes people use them in different context, some even develop with live reload under docker. relying on workdir also prevents changing it everywhere in case of rename.
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 would still advise against using COPY . .
to avoid beginner mistakes. With HRM you would mount the files, and that is fine, but when you COPY
, you do copy files into your image! You can very easily make a mistake and blow up your image size and even leak sensitive information with things like .env
.
|
||
FROM base AS build-deps | ||
RUN npm install --production=false | ||
RUN npm install |
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.
Suggestion: Instead of install
, it would be safer to use ci
. At this stage, installing is essentially a clean install, but if someone copies this into a different context, they might face some unintended behaviors.
RUN npm install | |
RUN npm ci |
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 will keep this consistent with the original instruction, just removing the flag. If there are changes to be made to the recipe otherwise, we can always revisit!
@@ -148,10 +148,10 @@ WORKDIR /app | |||
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.
Suggestion/Nitpick: While ./
works fine, perhaps /app/
would convey more information without relying on the previous state of the WORKDIR
.
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.
both are ok I think
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.
impact of changes is low, changes are strictly equivalent but newer notation so fancy future proof.
@@ -148,10 +148,10 @@ WORKDIR /app | |||
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.
both are ok I think
|
||
FROM base AS build-deps | ||
RUN npm install --production=false | ||
RUN npm install | ||
|
||
FROM build-deps AS build | ||
COPY . . |
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.
it's different working styles, I guess the doc purpose is only to convey examples, it's hard to cover all use cases, and sometimes people use them in different context, some even develop with live reload under docker. relying on workdir also prevents changing it everywhere in case of rename.
Thank you everyone for discussing this so thoughtfully and thoroughly! (And reminder, at this point it's only the submitted change that we're considering. If there's other text on the page someone feels should be changed, that's out of the scope of this proposed change and a separate PR can be made.) |
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.
Thank you for taking the time to contribute back the fix that worked for you @corneliusroemer ! We appreciate your efforts, and are happy to welcome you to Team Docs! 🥳
* i18n(fr): Update `ecommerce.mdx` file from #8167 (STEPS) Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Update `rss.mdx` file from #8167 (STEPS) Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Update `add-yaml-support.mdx` file from #8167 (STEPS) Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Update `build-custom-img-component.mdx` file from #8167 (STEPS) Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Update `build-forms-api.mdx` file from #8167 (STEPS) Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Update `build-forms.mdx` file from #8167 (STEPS) Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Update `call-endpoints.mdx` file from #8167 (STEPS) Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Update `captcha.mdx` file from #8167 (STEPS) Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Update `docker.mdx` file from #8167 (STEPS) Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Update `dynamically-importing-images.mdx` file from #8167 (STEPS) Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Update `external-links.mdx` file from #8167 (STEPS) Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Update `i18n.mdx` file from #8167 (STEPS) Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Update `modified-time.mdx` file from #8167 (STEPS) Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Update `sharing-state.mdx` file from #8167 (STEPS) Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Update `tailwind-rendered-markdown.mdx` file from #8167 (STEPS) Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Fix Steps indents in external-links.mdx Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Fix indents ? Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Fix indents ? Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * Discard changes to src/content/docs/en/recipes/external-links.mdx * Update `docker.mdx` to #8226 --------- Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> Co-authored-by: Yan <61414485+yanthomasdev@users.noreply.github.com>
…ithastro#8226) Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
…ro#8260) * i18n(fr): Update `ecommerce.mdx` file from withastro#8167 (STEPS) Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Update `rss.mdx` file from withastro#8167 (STEPS) Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Update `add-yaml-support.mdx` file from withastro#8167 (STEPS) Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Update `build-custom-img-component.mdx` file from withastro#8167 (STEPS) Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Update `build-forms-api.mdx` file from withastro#8167 (STEPS) Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Update `build-forms.mdx` file from withastro#8167 (STEPS) Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Update `call-endpoints.mdx` file from withastro#8167 (STEPS) Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Update `captcha.mdx` file from withastro#8167 (STEPS) Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Update `docker.mdx` file from withastro#8167 (STEPS) Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Update `dynamically-importing-images.mdx` file from withastro#8167 (STEPS) Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Update `external-links.mdx` file from withastro#8167 (STEPS) Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Update `i18n.mdx` file from withastro#8167 (STEPS) Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Update `modified-time.mdx` file from withastro#8167 (STEPS) Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Update `sharing-state.mdx` file from withastro#8167 (STEPS) Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Update `tailwind-rendered-markdown.mdx` file from withastro#8167 (STEPS) Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Fix Steps indents in external-links.mdx Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Fix indents ? Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Fix indents ? Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * Discard changes to src/content/docs/en/recipes/external-links.mdx * Update `docker.mdx` to withastro#8226 --------- Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> Co-authored-by: Yan <61414485+yanthomasdev@users.noreply.github.com>
…ithastro#8226) Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
…ro#8260) * i18n(fr): Update `ecommerce.mdx` file from withastro#8167 (STEPS) Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Update `rss.mdx` file from withastro#8167 (STEPS) Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Update `add-yaml-support.mdx` file from withastro#8167 (STEPS) Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Update `build-custom-img-component.mdx` file from withastro#8167 (STEPS) Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Update `build-forms-api.mdx` file from withastro#8167 (STEPS) Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Update `build-forms.mdx` file from withastro#8167 (STEPS) Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Update `call-endpoints.mdx` file from withastro#8167 (STEPS) Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Update `captcha.mdx` file from withastro#8167 (STEPS) Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Update `docker.mdx` file from withastro#8167 (STEPS) Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Update `dynamically-importing-images.mdx` file from withastro#8167 (STEPS) Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Update `external-links.mdx` file from withastro#8167 (STEPS) Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Update `i18n.mdx` file from withastro#8167 (STEPS) Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Update `modified-time.mdx` file from withastro#8167 (STEPS) Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Update `sharing-state.mdx` file from withastro#8167 (STEPS) Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Update `tailwind-rendered-markdown.mdx` file from withastro#8167 (STEPS) Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Fix Steps indents in external-links.mdx Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Fix indents ? Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Fix indents ? Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * Discard changes to src/content/docs/en/recipes/external-links.mdx * Update `docker.mdx` to withastro#8226 --------- Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> Co-authored-by: Yan <61414485+yanthomasdev@users.noreply.github.com>
…ithastro#8226) Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
…ro#8260) * i18n(fr): Update `ecommerce.mdx` file from withastro#8167 (STEPS) Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Update `rss.mdx` file from withastro#8167 (STEPS) Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Update `add-yaml-support.mdx` file from withastro#8167 (STEPS) Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Update `build-custom-img-component.mdx` file from withastro#8167 (STEPS) Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Update `build-forms-api.mdx` file from withastro#8167 (STEPS) Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Update `build-forms.mdx` file from withastro#8167 (STEPS) Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Update `call-endpoints.mdx` file from withastro#8167 (STEPS) Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Update `captcha.mdx` file from withastro#8167 (STEPS) Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Update `docker.mdx` file from withastro#8167 (STEPS) Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Update `dynamically-importing-images.mdx` file from withastro#8167 (STEPS) Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Update `external-links.mdx` file from withastro#8167 (STEPS) Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Update `i18n.mdx` file from withastro#8167 (STEPS) Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Update `modified-time.mdx` file from withastro#8167 (STEPS) Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Update `sharing-state.mdx` file from withastro#8167 (STEPS) Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Update `tailwind-rendered-markdown.mdx` file from withastro#8167 (STEPS) Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Fix Steps indents in external-links.mdx Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Fix indents ? Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * i18n(fr): Fix indents ? Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> * Discard changes to src/content/docs/en/recipes/external-links.mdx * Update `docker.mdx` to withastro#8226 --------- Signed-off-by: Thomas Bonnet <thomasbnt@protonmail.com> Co-authored-by: Yan <61414485+yanthomasdev@users.noreply.github.com>
Description (required)
This fixes npm warnings that I get using the current suggested Dockerfile, see warnings:
Related issues & labels (optional)