Ironically it was only yesterday that someone asked "Ask HN: Why do tutorial writers combine 10 technologies when 1 or 2 would do?"[1]<p>I think this is a perfect example of how <i>not</i> to write a tutorial. It doesn't actually <i>teach</i> anything - instead it is effectively a set of commands that someone should type in exactly and it will work.. hopefully.<p>I think this point in the introduction sums up this approach:<p><i>I’d like to point out that the broken branch wasn’t working for some (still) unknown reason related to versioning between when we set up the system and when we upgraded some of the components including nodejs.</i><p>and later:<p><i>Note for the app we created we used nodejs v8.10.0 and npm v6.4.0, although installing newer versions shouldn’t be an issue.</i><p>So.. they don't know why it broke, but any newer version <i>should be fine</i>.<p>[1] <a href="https://news.ycombinator.com/item?id=18950679" rel="nofollow">https://news.ycombinator.com/item?id=18950679</a>
It is a bad idea to use a full-blown Node.js web server to serve some static content. A better solution would be to build the app in one container and then build another Nginx container to serve it. This container can then be hardened (run as non-root, use a read-only filesystem). An added benefit is that Nginx uses fewer system resources (~10 megabytes of RAM will work just fine).<p>We’re running such a setup in production; a sample Dockerfile can be found on <a href="https://github.com/WISVCH/docker-nginx" rel="nofollow">https://github.com/WISVCH/docker-nginx</a>.