Skip to content
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
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
npm-debug.log
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
9 changes: 1 addition & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
# Set the base image
FROM node:13
FROM node:10

# Set the working directory
WORKDIR /usr/src/app

# Copy package.json & package-lock.json to the workdir
COPY package*.json ./

# Install app dependencies
RUN npm install

# Copy app source code
COPY . .

# Expose port 3000
EXPOSE 3000

# Start application
CMD ["npm", "start"]
9 changes: 2 additions & 7 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
version: '3'
services:
app:
container_name: docker-nodejs-mongo
container_name: docker-node-mongo
restart: always
# Will look at the current directory for the Dockerfile
build: .
ports:
- '80:3000'
links:
- mongo
mongo:
container_name: mongo
image: mongo:latest
image: mongo
ports:
- '27017:27017'
volumes:
- mongodata:/data/db
volumes:
mongodata:
2 changes: 1 addition & 1 deletion models/item.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const ItemSchema = new Schema({
item: {
type: String,
require: true
}.
},
date: {
type: Date,
default: Date.now
Expand Down
Loading