Document Node.js-Docker integration

This commit is contained in:
Nikita P. Shupeyko 2017-05-14 13:56:50 +03:00
parent 1abba22416
commit ee92a13902
3 changed files with 50 additions and 0 deletions

View File

@ -6,6 +6,8 @@ Getting Up and Running Locally With Docker
The steps below will get you up and running with a local development environment.
All of these commands assume you are in the root of your generated project.
.. _devlocdocker-prereq:
Prerequisites
-------------
@ -30,6 +32,9 @@ Currently PostgreSQL (``psycopg2`` python package) is not installed inside Docke
Doing this will prevent the project from being installed in an Windows-only environment (thus without usage of Docker). If you want to use this project without Docker, make sure to remove ``psycopg2`` from the requirements again.
.. _devlocdocker-build-the-stack:
Build the Stack
---------------
@ -40,6 +45,9 @@ on your development system::
If you want to build the production environment you don't have to pass an argument -f, it will automatically use docker-compose.yml.
.. _devlocdocker-boot-the-system:
Boot the System
---------------

View File

@ -17,6 +17,7 @@ Contents:
developing-locally-docker
settings
linters
nodejs-with-docker
live-reloading-and-sass-compilation
deployment-on-pythonanywhere
deployment-on-heroku

View File

@ -0,0 +1,41 @@
Node.js with Docker
===================
.. index:: node, nodejs, docker, docker-compose
`Node.js`_ support is provided out-of-the-box, ready for use as-is, or with any kind of customizations suiting the specific needs of the project.
.. _`Node.js`: https://nodejs.org/en/
*Note, all paths given are relative to the generated project's root.*
Prerequisites
-------------
- The project was generated with :code:`use_docker` set to :code:`y`.
- These :ref:`devlocdocker-prereq` are met as well.
Overview
--------
Essential aspects of integration are
- node docker-compose service (:code:`node`) definition in :code:`./dev.yml`;
- :code:`./compose/node/Dockerfile-dev` defining the :code:`node` image;
- :code:`./node_modules/` 'overlayed' with :code:`/app/node_modules/`, its counterpart from the running instance of :code:`node`.
Workflow
--------
#. :ref:`devlocdocker-build-the-stack`:
- when building :code:`node` image from scratch, dependencies from :code:`package.json` are installed.
#. :ref:`devlocdocker-boot-the-system`.
To log the running :code:`node` container's activity,
.. code-block:: bash
$ docker-compose -f dev.yml logs node