Docsmith not starting in docker
jezuk opened this issue · 4 comments
Prerequisites
-
I have written a descriptive issue title
-
I have searched existing issues to ensure it has not already been reported
-
I agree to follow the Code of Conduct that this project adheres to
API/app/plugin version
10.0.8
Node.js version
18.14.2
Operating system
Ubuntu
Operating system version (i.e. 20.04, 11.3, 10)
20.04
Description
docker-compose up
fails with the error below
jez@u22:~/repos/docsmith$ docker-compose up
docsmith is up-to-date
Attaching to docsmith
docsmith | node:internal/modules/cjs/loader:444
docsmith | throw err;
docsmith | ^
docsmith |
docsmith | Error: Cannot find module '/usr/app/dist/app.js'. Please verify that the package.json has a valid "main" entry
docsmith | at tryPackage (node:internal/modules/cjs/loader:436:19)
docsmith | at Module._findPath (node:internal/modules/cjs/loader:678:18)
docsmith | at resolveMainPath (node:internal/modules/run_main:19:25)
docsmith | at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:75:24)
docsmith | at node:internal/main/run_main_module:23:47 {
docsmith | code: 'MODULE_NOT_FOUND',
docsmith | path: '/usr/app/package.json',
docsmith | requestPath: '/usr/app'
docsmith | }
docsmith |
docsmith | Node.js v18.14.2
The dist
folder contains no files, just the temp
folder created in the Dockerfile, node_modules
, package.json
and package-lock.json
are present.
I had a go at fixing this myself by adding an extra build step and including esbuild files, but not sure if this is the correct approach.
Thanks for any help you can provide.
Steps to Reproduce
docker-compose up
Expected Behaviour
No response
Just to confirm, are you downloading the release asset (not the source code) via https://github.com/Fdawgs/docsmith/releases/tag/v10.0.8, as per the setup steps?
I can't replicate the behaviour unfortunately:
If you are running from a clone or fork of the source code you will need to run npm ci && npm run build
prior to running docker, which will install esbuild and run it, dropping the compiled code into /dist
.
Ahh that makes sense, I'm cloning the repo as git submodule, thanks for clarifying. It would be helpful in my scenario if esbuild could take place in the container as that would negate the need for Node 18 on the host.
Hi @jezuk, not really keen on adding this as it would open up an extra attack surface on the image.
The image would have to use npm i
to install dev dependencies, instead of npm ci --omit=dev --ignore-scripts
as it is doing.
OWASP does a better job of explaining why this is an issue!
For your use case I would recommend forking the repo and making the changes to the Dockerfile in that, and then pulling down any bug fixes from this repo as and when.