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
20 changes: 15 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
FROM node:4.2
COPY . /src
RUN cd /src && npm install
EXPOSE 4000
CMD ["node", "/src/server.js"]
# Stage 1: Build the application
FROM node:18-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build

# Stage 2: Create the production image
FROM alpine:latest
WORKDIR /app
COPY --from=builder /app/dist .
COPY start.sh .
EXPOSE 3000
CMD ["./start.sh"]
39 changes: 32 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,37 @@
{
"name": "docker-test",
"name": "my-complex-app",
"version": "1.0.0",
"description": "",
"main": "server.js",
"description": "A complex Node.js application for node docker test",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node server.js"
"start": "node index.js",
"dev": "nodemon index.js",
"build": "webpack --mode production",
"test": "jest",
"lint": "eslint .",
"format": "prettier --write .",
"deploy": "npm run build && pm2 deploy ecosystem.config.js prod"
},
"author": "Dana Woodman <dana@danawoodman.com> (http://danawoodman.com/)",
"license": "ISC"
"author": "Sidd",
"license": "MIT",
"dependencies": {
"express": "^4.18.2",
"mongoose": "^6.9.2",
"lodash": "^4.17.21"
},
"devDependencies": {
"nodemon": "^2.0.22",
"webpack": "^5.75.5",
"webpack-cli": "^4.10.0",
"jest": "^29.6.4",
"eslint": "^8.45.0",
"prettier": "^2.8.8",
"pm2": "^5.4.2"
},
"engines": {
"node": ">=16.14.0"
},
"config": {
"port": 3000
}
}