Git Product home page Git Product logo

docker-nodejs's Introduction

Docker for Node.js Projects

Folder Structure

The project folder should be as such:

Project Folder
  ├─README.md
  ├─Dockerfile
  ├─nodejs-project.yml
  ├─app.js
  ├─package.json
  └─<other nodejs codes files, etc.>

Volume mapping for /usr/src/app

The container's /usr/src/app has been mapped to the root of the Project Folder. This allow codes to be edited on the host computer while having changes reflected in the Node.js application. Server-side codes will still require the container to be restarted.

/usr/src/app/node_modules trickery

A docker volume mapping has been declared for container's /usr/src/node_modules directory. Do not manually map this directory to your host computer as this would break the installed Node.js modules.

The trickery is to map /usr/src/app to the host computer while leaving the sub-directory (/usr/src/app/node_modules) unmapped.

Docker container

Building the project for the first time

docker-compose -f .\nodejs-project.yml build

Running the project

docker-compose -f .\nodejs-project.yml up

Stopping the project

docker-compose -f .\nodejs-project.yml stop

docker-nodejs's People

Contributors

shadowandy avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.