Skip to content
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

Merged
merged 2 commits into from May 14, 2024

Conversation

corneliusroemer
Copy link
Contributor

@corneliusroemer corneliusroemer commented May 8, 2024

Description (required)

This fixes npm warnings that I get using the current suggested Dockerfile, see warnings:

[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.

Related issues & labels (optional)

  • Closes #
  • Suggested label:

…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.
```
Copy link

vercel bot commented May 8, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 14, 2024 0:55am
docs-i18n 🔄 Building (Inspect) Visit Preview 💬 Add feedback May 14, 2024 0:55am

@corneliusroemer corneliusroemer changed the title docker.mdx: use --omit=dev for npm instead of deprecated `--product… docker.mdx: use --omit=dev for npm over deprecated --production May 8, 2024
@astrobot-houston
Copy link
Contributor

Hello! Thank you for opening your first PR to Astro’s Docs! 🎉

Here’s what will happen next:

  1. Our GitHub bots will run to check your changes.
    If they spot any broken links you will see some error messages on this PR.
    Don’t hesitate to ask any questions if you’re not sure what these mean!

  2. In a few minutes, you’ll be able to see a preview of your changes on Vercel 🥳

  3. One or more of our maintainers will take a look and may ask you to make changes.
    We try to be responsive, but don’t worry if this takes a few days.

@astrobot-houston
Copy link
Contributor

astrobot-houston commented May 8, 2024

Lunaria Status Overview

🌕 This pull request will trigger status changes.

Learn more

By default, every PR changing files present in the Lunaria configuration's files property will be considered and trigger status changes accordingly.

You can change this by adding one of the keywords present in the ignoreKeywords property in your Lunaria configuration file in the PR's title (ignoring all files) or by including a tracker directive in the merged commit's description.

Tracked Files

Locale File Note
en recipes/docker.mdx Source changed, localizations will be marked as outdated.
Warnings reference
Icon Description
🔄️ The source for this localization has been updated since the creation of this pull request, make sure all changes in the source have been applied.


FROM base AS build-deps
RUN npm install --production=false
RUN npm install

FROM build-deps AS build
COPY . .
Copy link

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.

Copy link

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.

Copy link
Contributor

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.

Copy link

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
Copy link

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.

Suggested change
RUN npm install
RUN npm ci

Copy link
Member

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 ./
Copy link

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.

Copy link
Contributor

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

Copy link
Contributor

@wassfila wassfila left a 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 ./
Copy link
Contributor

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 . .
Copy link
Contributor

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.

src/content/docs/en/recipes/docker.mdx Show resolved Hide resolved
@sarah11918
Copy link
Member

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.)

Copy link
Member

@sarah11918 sarah11918 left a 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! 🥳

@sarah11918 sarah11918 added code snippet update Updates a code sample: typo, outdated code etc. Merge Queue Approved and ready to be merged (wait for feature release if also labelled M-O-R)! labels May 14, 2024
@sarah11918 sarah11918 merged commit 0ee7ea1 into withastro:main May 14, 2024
7 of 8 checks passed
yanthomasdev added a commit to thomasbnt/docs that referenced this pull request May 14, 2024
yanthomasdev added a commit that referenced this pull request May 14, 2024
* 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>
wpplumber pushed a commit to wpplumber/astro-docs that referenced this pull request May 15, 2024
…ithastro#8226)

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
wpplumber pushed a commit to wpplumber/astro-docs that referenced this pull request May 15, 2024
…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>
wpplumber pushed a commit to wpplumber/astro-docs that referenced this pull request May 15, 2024
…ithastro#8226)

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
wpplumber pushed a commit to wpplumber/astro-docs that referenced this pull request May 15, 2024
…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>
wpplumber pushed a commit to wpplumber/astro-docs that referenced this pull request May 15, 2024
…ithastro#8226)

Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
wpplumber pushed a commit to wpplumber/astro-docs that referenced this pull request May 15, 2024
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code snippet update Updates a code sample: typo, outdated code etc. Merge Queue Approved and ready to be merged (wait for feature release if also labelled M-O-R)!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants