This project can be used as a starter to create a local environment to develop an application with Node.js using Docker.
The idea is that you can use docker to develop your Node.js application, without having to install anything on your system.
Top benefits:
- easy: you can easily configure your environment with the needed tools and versions
- isolation: you will not mess up your system, anything is containerized and could be cleared in a moment
- consistency: Docker provides a consistent environment for your application, the same for every developer or system
To use this build, you need to have Memento, Memento Kickstarter plugin and Memento Docker plugin installed.
Alternatively, you can use the ./configure script.
Start by creating a new project using this repository as template.
memento kickstarter create nodejsStart by creating a new project using this repository as template.
git clone https://github.com/bmeme/docker-nodejs-kickstarter.gitMove to your new project dir and run memento docker configure.
You will be asked a couple of questions to complete the project startup.
If everything is ok you will see a basic help with some information about the available commands.
To create the docker environment for your project, run:
memento docker configure docker:create./configure docker:createTo interact with the container, you can use memento docker cmd.
It will run the command passed to it inside the container.
You can check that everything is working by running:
memento docker cmd node --versionEureka! If you can see node version probably anything went well, and you can start developing your awesome application!
eval $(./configure env)c node --versionGo ahead and read how to get the full potential out of your new development environment by understanding the docker environment lifecycle, how to use the wrappers and how to interact directly with your container!
Suppose we want to start a new React application. Here is what you need to do to be up and running in near-zero time.
We can run create-react-app using the npx wrapper to generate a new React application:
memento docker cmd npx create-react-app appWith this command we are telling create-react-app to generate the application in the app directory.
c npx create-react-app appWhen the application is successfully generated, move the app directory and run it with:
memento docker configure node:startPretty straightforward, isn't it?
Note: to access the application with dinghy-http-proxy or dnsdock alias, see memento docker configure output.
./configure node:startYou can run a shell directly inside the container:
memento docker cmd bashAny feedback, bug reports or ideas are extremely welcome.
Reach us through our website or send us an email at info@bmeme.com.