Building ready to run NodeBB Docker images

Technical Support
  • 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 build needs 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 build as 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.

    Thanks.

  • This is probably a dependency on the config file. Try building/dropping a static one in place before this step to validate.

  • The ./nodebb setup should run the build step at the end. The web installer should do the same.

  • @pitaj

    If I run ./nodebb setup in 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 [6] - verbose: [minifier] utilizing a maximum of 2 additional threads
    2017-12-29T07:41:22.054Z [6] - 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
    
    
  • @andreassolberg so it assumes that the database should be running before you run the setup on the docker image.

  • I did a quick test to verify that nodebb setup will 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.


Suggested Topics