Building ready to run NodeBB Docker images
NodeBB already contains a Dockerfile and is publishing docker images to docker hub.
It appears to me that the Dockerfile is not preparing all the required steps during the Docker build phase, but leave some parts for run time.
It appears to me that
./nodebb buildneeds to run to prepare all the assets, minified js and more, and this command is not executed during Docker build phase, right?
I'm trying to add
RUN ./nodebb buildas part of the Dockerfile, but it fails because it requires configuration to a running database in order to complete the build. This feels strange, why would the build phase need access to the database? Is there any shortcut to make the build command work without a database? Something like executing grunt directly or similar.
If I run
./nodebb setupin the Dockerfile, it will require a valid config, but also that the config points to a database, and unfortunately it will even contact the database and fail if it cannot connect.
2017-12-29T07:41:20.788Z  - verbose: [minifier] utilizing a maximum of 2 additional threads 2017-12-29T07:41:22.054Z  - error: Error: Redis connection to xxxx:11216 failed - getaddrinfo ENOTFOUND xxxx xxxx:11216 at errnoException (dns.js:50:10) at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:92:26) The command '/bin/sh -c ./nodebb setup' returned a non-zero code: 1
I did a quick test to verify that
nodebb setupwill attempt to verify mongo access even if it has been provided - which I expected, but... and it does.
So it seems that the best practice here would be to pass the values in as part of the build with the assumption that the Redis or mongo instance already exists.