Correct Docker files

Signed-off-by: Drasko DRASKOVIC <drasko.draskovic@gmail.com>
This commit is contained in:
Drasko DRASKOVIC 2016-04-20 00:20:57 +02:00
parent 129e911652
commit 021427431a
3 changed files with 41 additions and 18 deletions

View File

@ -8,7 +8,7 @@ MAINTAINER Mainflux
RUN apt-get update -qq && apt-get install -y build-essential
RUN mkdir /src
RUN mkdir /mainflux
###
# Installations
@ -19,8 +19,8 @@ RUN npm install -g gulp
RUN npm install -g nodemon
# Finally, install all project Node modules
WORKDIR /src
ADD package.json /src/package.json
COPY . /mainflux
WORKDIR /mainflux
RUN npm install
EXPOSE 8080

View File

@ -1,16 +1,39 @@
api:
build: .
volumes:
- ".:/src"
ports:
- "8080:8080"
# set up links so that api knows about db, redis, etc...
links:
- mongodb
container_name: mainflux-api-docker
###
# Copyright (c) Mainflux
#
# Mainflux server is licensed under an Apache license, version 2.0 license.
# All rights not explicitly granted in the Apache license, version 2.0 are reserved.
# See the included LICENSE file for more details.
###
mongodb:
image: mongo
###
# MongoDB
###
mongo:
image: mongo:3.2
container_name: mainflux-mongodb
command: --smallfiles --nojournal
###
# NATS
###
nats:
image: apcera/gnatsd:latest
container_name: mainflux-nats
ports:
- "27017:27017"
container_name: mainflux-mongo-docker
- "4222:4222"
- "8333:8333"
###
# Mainflux
###
mainflux:
image: mainflux/mainflux-lite:latest
container_name: mainflux-api
volumes:
- ./config:/mainflux/config
links:
- mongo
- nats
ports:
- "8080:8080"

View File

@ -19,7 +19,7 @@ var mongoose = require('mongoose');
/** Check if we run with Docker compose */
var dockerMongo = process.env.MONGODB_NAME;
var dbUrl = '';
if (dockerMongo && dockerMongo == '/mainflux-api-docker/mongodb') {
if (dockerMongo && dockerMongo == '/mainflux-api/mongodb') {
dbUrl = 'mongodb://' + process.env.MONGODB_PORT_27017_TCP_ADDR + ':' + process.env.MONGODB_PORT_27017_TCP_PORT + '/' + config.db.name;
} else {
dbUrl = 'mongodb://' + config.db.addr + ':' + config.db.port + '/' + config.db.name;