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


  • 0 Votes
    7 Posts
    253 Views

    @julian any updates please post here.

  • nginx reverse proxy nodebb

    Solved Technical Support
    0 Votes
    4 Posts
    3k Views

    Yes, the url in config.json should be equal to exactly the URL at which you access your site. It usually shouldn't be localhost or an IP address.

  • 0 Votes
    4 Posts
    1k Views

    @tomanagle can you get to the forum by using domain:port?

  • 0 Votes
    8 Posts
    4k Views

    Ok, I installed Git, now the command works. Currently cloning... and finally installing dependencises... and I received these erros:

    It also ask me now for a redis database name. What should I write for it?

    npm WARN deprecated [email protected]: lodash@<2.0.0 is no longer maintained. Upgrade to lodash@^3.0.0
    npm WARN deprecated [email protected]: lodash@<2.0.0 is no longer maintained. Upgrade to lodash@^3.0.0

    buffe[email protected] install /Users/Dakoom/NodeBB/node_modules/bufferutil
    node-gyp rebuild

    xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

    xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

    CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
    SOLINK_MODULE(target) Release/bufferutil.node

    utf-8-validat[email protected] install /Users/Dakoom/NodeBB/node_modules/utf-8-validate
    node-gyp rebuild

    xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

    xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

    CXX(target) Release/obj.target/validation/src/validation.o
    SOLINK_MODULE(target) Release/validation.node

    h[email protected] install /Users/Dakoom/NodeBB/node_modules/heapdump
    node-gyp rebuild

    xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

    xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

    CXX(target) Release/obj.target/addon/src/heapdump.o
    SOLINK_MODULE(target) Release/addon.node

    EDIT: Ok, installed. Then I suppose that when I entered the db name it automatically created it. Ok, I have it installed and I'll try it a little bit! 🙂 Thank you all for your suggestions!