Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dockerized! #37

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM node:8.11.1

# Create app directory
WORKDIR /usr/src/app

# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5+)
COPY package*.json ./
# COPY .sequelizerc ./

RUN npm install --global nodemon
RUN npm install
# Wil create cassandra keysapce and tables

# If you are building your code for production
# RUN npm install --only=production


# Bundle app source
COPY . .

EXPOSE 8080

CMD [ "nodemon", "server.js" ]
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,18 @@ Node provides the RESTful API. Angular provides the frontend and accesses the AP
- [Node and npm](http://nodejs.org)
- MongoDB: Make sure you have your own local or remote MongoDB database URI configured in `config/database.js`

# Running the app with Docker

Install [Docker](https://www.docker.com/) and docker-compose. If you use Windows, click on the icon that will appear on your tray and [enable Shared Drives](https://docs.docker.com/docker-for-windows/#general).

Then go to the root of this project and:

```bash
$ docker-compose up
```

This will use the docker-compose.yml file inside the infra directory to download and prepare what is needed to run the API. It uses Node.js and MongoDB as the database, so we have 2 Docker containers.

## Installation

1. Clone the repository: `git clone [email protected]:scotch-io/node-todo`
Expand Down
2 changes: 1 addition & 1 deletion config/database.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
remoteUrl : 'mongodb://node:[email protected]:27017/uwO3mypu',
localUrl: 'mongodb://localhost/meanstacktutorials'
localUrl: 'mongodb://todo-mongo:27017/todo-app'
};
19 changes: 19 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: '3'

services:
todo-node:
build:
context: .
ports:
- "8080:8080"
container_name: todo-node
depends_on:
- todo-mongo

todo-mongo:
image: mongo:latest
restart: always
environment:
MONGO_INITDB_DATABASE: todo-app
container_name: todo-mongo