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

following your Docker setup by the letter ends in error #7027

Open
mpstaton opened this issue Feb 24, 2024 · 1 comment
Open

following your Docker setup by the letter ends in error #7027

mpstaton opened this issue Feb 24, 2024 · 1 comment
Labels
help - confirm behaviour Walk through the example/issue and confirm this is a general behaviour, or a correct update to make. improve documentation Enhance existing documentation (e.g. add an example, improve description)

Comments

@mpstaton
Copy link

mpstaton commented Feb 24, 2024

📚 Subject area/topic

Docker setup

📋 Page(s) affected (or suggested, for new content)

https://docs.astro.build/en/recipes/docker/

📋 Description of content that is out-of-date or incorrect

I don't know, it just throws an error.
Line 12 throws an error. CMD node ./dist/server/entry.mjs

But from the look of it, it doesn't even make it to the full node_modules install.

🖥️ Reproduction in StackBlitz (if reporting incorrect content or code samples)

node:internal/modules/cjs/loader:1147
2024-02-24 15:29:40 throw err;
2024-02-24 15:29:40 ^
2024-02-24 15:29:40
2024-02-24 15:29:40 Error: Cannot find module '/app/dist/server/entry.mjs'
2024-02-24 15:29:40 at Module._resolveFilename (node:internal/modules/cjs/loader:1144:15)
2024-02-24 15:29:40 at Module._load (node:internal/modules/cjs/loader:985:27)
2024-02-24 15:29:40 at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
2024-02-24 15:29:40 at node:internal/main/run_main_module:28:49 {
2024-02-24 15:29:40 code: 'MODULE_NOT_FOUND',
2024-02-24 15:29:40 requireStack: []
2024-02-24 15:29:40 }
2024-02-24 15:29:40
2024-02-24 15:29:40 Node.js v20.11.1

Here's from the Inspect file in DockerDesktop.
],
"State": {
"Status": "exited",
"Running": false,
"Paused": false,
"Restarting": false,
"OOMKilled": false,
"Dead": false,
"Pid": 0,
"ExitCode": 1,
"Error": "",
"StartedAt": "2024-02-24T21:29:40.61032129Z",
"FinishedAt": "2024-02-24T21:29:40.636170537Z"
},

@mpstaton mpstaton added the improve documentation Enhance existing documentation (e.g. add an example, improve description) label Feb 24, 2024
@Fryuni
Copy link
Member

Fryuni commented Feb 25, 2024

Hi @mpstaton, thanks for the report!

I followed the guide, using the two given files (Dockerfile and .dockerignore) verbatim and everything worked fine.

By the error you see, I assume you are using the section about SSR on Docker. As it mentions in the docs:

This Dockerfile will build your site and serve it using Node.js on port 4321 and therefore requires the Node adapter installed in your Astro project.

You have to start from a project with the Node adapter, which in turn requires the output to be either "server" or "hybrid". If that config is missing or set to static, or if you are not using the Node adapter, you'll see the error you posted.

Can you check that?

@sarah11918 sarah11918 added the help - confirm behaviour Walk through the example/issue and confirm this is a general behaviour, or a correct update to make. label Mar 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help - confirm behaviour Walk through the example/issue and confirm this is a general behaviour, or a correct update to make. improve documentation Enhance existing documentation (e.g. add an example, improve description)
Projects
None yet
Development

No branches or pull requests

3 participants