GithubHelp home page GithubHelp logo

shahzaibalikhan / node-docker-demo Goto Github PK

View Code? Open in Web Editor NEW

This project forked from karllhughes/node-docker-demo

0.0 1.0 0.0 47 KB

A simple application to demonstrate using Docker for local NodeJS app development

JavaScript 84.93% HTML 12.94% CSS 2.13%

node-docker-demo's Introduction

Node Docker Demo

This is a simple application to demonstrate using Docker for local NodeJS app development. It uses Node v9, Express, Sequelize and Postgres for data storage, and Handlebars for views.

Prerequisites

Quickstart

  • Clone this repo: git clone https://github.com/karllhughes/node-docker-demo.git
    • Note: The master branch has all the Docker-related files included, while the start-here branch does not. If you plan on doing the tutorial written for Javascript January, use the start-here branch, but if you want something that works right away, use the master branch.
  • Make sure Docker is running and that you're using version 17+ by running: docker -v
  • Run docker build -t node-docker . to build a local version of the image.
  • Start a postgres database container before you start the application: docker run -d --rm -p 5432:5432 -e POSTGRES_USER=admin -v $(pwd)/.data:/var/lib/postgresql/data -v $(pwd)/sql:/sql --name nd-db postgres:9.6
    • Wait a few seconds for the database to boot up before running any queries on it, especially if this is your first time running the application.
  • If it's your first time, run the migrations to create the database table: docker exec nd-db psql admin admin -f /sql/migrations.sql
  • You can also seed the database with dummy date using: docker exec nd-db psql admin admin -f /sql/seeds.sql
  • Now you can run the application using Docker: docker run --rm -p 3000:3000 -d -v $(pwd)/app:/src/app -v $(pwd)/public:/src/public --link nd-db --name nd-app node-docker
  • Check that the containers are running by typing docker ps and then navigating to http://localhost:3000/ in your browser.
  • To shut the application down, enter the command docker stop nd-app nd-db

If you're new to Docker, be sure to read the complete tutorial for explanations behind the Docker commands used.

Contributing

Contributions on Github are welcome and appreciated! Submit an issue or pull request with your improvements or suggestions.

License

This software is offered as-is under the MIT License:

MIT License

Copyright (c) 2017 Karl L. Hughes

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

node-docker-demo's People

Contributors

karllhughes avatar

Watchers

 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.