reactjsnode.jsdockercontainersreact-fullstack

How to ship Node.js API and React.js in single Docker Container?


How can I efficiently package and deploy multiple related applications (React frontend and Node.js backend) within a single container? Where containers are meant to be single-process deployments and common statement heard in topic of serving static files with Node.js are performance issues.My current approach involves separate Dockerfiles for each application, using NGINX for the frontend and Node.js for the backend.


Solution

  • It's not worthly to worry about performance before application gets deployed at the first place, there is much unknowns in area for optimalization such as requests per second, bundle size, complexity of operations and so on.

    By the problem presented in question I was really looking for serving out static content by Node.js server which reduces deployment to single container, and by such deployment and operational costs - it was optimal solution in budget where in fact application up to this day has not hit any performance bottlenecks that would make production not able to be used.

    Key takes:

    Disclaimer

    This answer was rewritten along the question to make it more informative for newcommers who may have similar problem. Previously I've come down to using Meteor.js which have seem to resolve my problem yet I did not understand the problem as a whole.