Skip to content

Commit bfc8e34

Browse files
author
Rishabh Garg
committed
Worked on docker file
1 parent e8f8548 commit bfc8e34

File tree

8 files changed

+1940
-33
lines changed

8 files changed

+1940
-33
lines changed

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Specify base image
2-
FROM node:alpine
2+
FROM node:14
33

44
WORKDIR /usr/app
55

@@ -11,7 +11,7 @@ RUN npm install
1111
COPY ./ .
1212

1313
#Expose port and start application
14-
EXPOSE 8080
14+
EXPOSE 8001
1515

1616
# Run command
1717
CMD ["npm", "run", "prod"]

Dockerfile.dev

Lines changed: 0 additions & 12 deletions
This file was deleted.

app/app.constant.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export const AppConfiguration = {
2-
DB_CONNECTION_STRING : 'mongodb://localhost:27017/MessangerDB',
2+
DB_CONNECTION_STRING : 'mongodb://192.168.160.1:27017/MessangerDB',
33
// Incase using mongdb docker container
44
// DB_CONNECTION_STRING : 'mongodb://mongo:27017/MessangerDB',
55
SECRET : 'nodeMessageApp2020'

app/controllers/conversation.controller.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export class ConversationController {
6161
}
6262
}
6363
},
64-
{ $sort: { _id: -1 } },
64+
{ $sort: { _id: 1 } },
6565
{ $limit: 1 }
6666

6767
],
@@ -79,7 +79,6 @@ export class ConversationController {
7979
{ $project: { lastMessage: { $arrayElemAt: ["$lastMessages", 0] }, unreadCount: "$seenObject.count", "members": 1, "createdAt": 1, "isGroup": 1, groupName: 1 } },
8080

8181
]);
82-
console.log(conversations);
8382
response.send(CumtomResponse.success(conversations, 'Conversations fetched'));
8483
} catch (error) {
8584
throw CumtomResponse.serverError(error, 'Error');

app/utils/mongoose.util.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import mongoose = require("mongoose");
1+
import { Types } from 'mongoose';
22

33
export class MongooseUtil {
4-
objectId(id : string): mongoose.Schema.Types.ObjectId {
5-
return mongoose.Types.ObjectId(id);
4+
objectId(id: string): Types.ObjectId {
5+
return Types.ObjectId(id);
66
}
77
}

docker-compose.yml

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,17 @@ version: "2"
22
services:
33
app:
44
container_name: app
5-
restart: always
5+
# restart: always
66
build: .
77
ports:
8-
- "3001:3001"
9-
links:
10-
- mongo
11-
mongo:
12-
container_name: mongo
13-
image: mongo
14-
volumes:
15-
- ./data:/data/db
16-
ports:
17-
- "27017:27017"
8+
- "8001:8001"
9+
# # I am using remote url of mongodb
10+
# links:
11+
# - mongo
12+
# mongo:
13+
# container_name: mongo
14+
# image: mongo
15+
# volumes:
16+
# - ./data:/data/db
17+
# ports:
18+
# - "27017:27017"

0 commit comments

Comments
 (0)