我正在使用 Sveltekit 构建一个小网站,现在我想将其容器化并在小型电脑上运行。我使用这个 Dockerfile:
FROM node:alpine
COPY /build /app
WORKDIR /app
CMD node build
但是当我启动容器时出现此错误:
2023-08-18 19:03:19 node:internal/modules/cjs/loader:1051
2023-08-18 19:03:19 throw err;
2023-08-18 19:03:19 ^
2023-08-18 19:03:19
2023-08-18 19:03:19 Error: Cannot find module '/app/build'
2023-08-18 19:03:19 at Module._resolveFilename (node:internal/modules/cjs/loader:1048:15)
2023-08-18 19:03:19 at Module._load (node:internal/modules/cjs/loader:901:27)
2023-08-18 19:03:19 at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12)
2023-08-18 19:03:19 at node:internal/main/run_main_module:23:47 {
2023-08-18 19:03:19 code: 'MODULE_NOT_FOUND',
2023-08-18 19:03:19 requireStack: []
2023-08-18 19:03:19 }
2023-08-18 19:03:19
2023-08-18 19:03:19 Node.js v20.5.1