Dockerfile does not build all files into `dist`
The docker container does not run due to the following error:
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module '/app/main'
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
I looked into it a little bit and it looks like main.js
(and a few other files) is not included from the builder step in /app/dist
. I tried copying the entire context into the container to build off of and it worked:
COPY ./ ./
instead of COPY ./src ./nest-cli.json ./tsconfig*.json ./
(https://gitlab.com/onestepprojects/health-module/-/blob/staging/backend/Dockerfile#L8.
We shouldn't need to copy everything, but it seems like something is missing.