Skip to content

Commit

Working on the dev environment

John Petersoncommitted Parent26804c4Browse files
9 files+921−530/9 viewed
+3−24
1−**/.classpath
2−**/.dockerignore
3−**/.env
4−**/.git
5−**/.gitignore
6−**/.project
7−**/.settings
8−**/.toolstarget
9−**/.vs
10−**/.vscode
11−**/*.*proj.user
12−**/*.dbmdl
13−**/*.jfm
14−**/azds.yaml
15−**/charts
16−**/docker-compose*
17−**/compose*
18−**/Dockerfile*
19−**/node_modules
20−**/npm-debug.log
21−**/obj
22−**/secrets.dev.yaml
23−**/values.dev.yaml
24−README.md
1+node_modules
2+npm-debug.log
3+.git
+17−7
1−FROM node:14-alpine
1+# https://blog.logrocket.com/node-js-docker-improve-dx/
2+FROM node:14-alpine as base
3+
4+WORKDIR /src
5+COPY package*.json /
6+EXPOSE 3000
7+
8+FROM base as production
29 ENV NODE_ENV=production
3−WORKDIR /usr/src/app
4−COPY ["package.json", "package-lock.json*", "npm-shrinkwrap.json*", "./"]
5−RUN npm install --production --silent && mv node_modules ../
6−COPY . .
7−EXPOSE 3000
8−CMD ["npm", "start"]
10+RUN npm ci
11+COPY . /
12+CMD ["node", "bin/www"]
13+
14+FROM base as dev
15+ENV NODE_ENV=development
16+RUN npm install -g nodemon && npm install
17+COPY . /
18+CMD ["nodemon", "bin/www"]
+0−14
1−version: '3.4'
2−
3−services:
4− todoapp:
5− image: todoapp
6− build:
7− context: .
8− dockerfile: ./Dockerfile
9− environment:
10− NODE_ENV: development
11− ports:
12− - 3000:3000
13− - 9229:9229
14− command: ["node", "--inspect=0.0.0.0:9229", "./bin/www"]
+8−4
1−version: '3.4'
1+version: '3.8'
22
33 services:
44 todoapp:
55 image: todoapp
66 build:
7− context: .
8− dockerfile: ./Dockerfile
7+ context: ./
8+ target: dev
9+ volumes:
10+ - .:/src
11+ command: "npm run start:dev"
912 environment:
10− NODE_ENV: production
13+ NODE_ENV: development
14+ DEBUG: nodejs-docker-express:*
1115 ports:
1216 - 3000:3000
+857−0
A large diff (1,115 lines) is not shown until you ask for it.
+5−2
33 "version": "0.0.0",
44 "private": true,
55 "scripts": {
6− "start": "node ./bin/www"
6+ "start": "node ./bin/www",
7+ "start:dev": "nodemon ./bin/www"
78 },
89 "dependencies": {
910 "cookie-parser": "~1.4.4",
1112 "express": "~4.16.1",
1213 "http-errors": "~1.6.3",
1314 "jade": "~1.11.0",
14− "morgan": "~1.9.1"
15+ "morgan": "~1.9.1",
16+ "nodemon": "^2.0.12",
17+ "vue": "^2.6.14"
1518 }
1619 }
+6−0
1+var app = new Vue({
2+ el: '#app',
3+ data: {
4+ message: 'Hello Vue!'
5+ }
6+ })
+6−2
22 var router = express.Router();
33
44 /* GET home page. */
5−router.get('/', function(req, res, next) {
6− res.render('index', { title: 'Express' });
5+// router.get('/', function(req, res, next) {
6+// res.render('index', { title: 'Express' });
7+// });
8+
9+router.get('/', function(req, res) {
10+ res.send('Some data here 3');
711 });
812
913 module.exports = router;
+19−0
1+<!doctype html>
2+<html>
3+ <head>
4+ <title>This is the title of the webpage!</title>
5+ <!-- development version, includes helpful console warnings -->
6+ <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
7+ </head>
8+ <body>
9+ <p>This is an example paragraph. Anything in the <strong>body</strong> tag will appear on the page, just like this <strong>p</strong> tag and its contents.</p>
10+
11+ <div id="app">
12+ {{ message }}
13+ </div>
14+
15+ <script src="/public/javascripts/index.js"></script>
16+
17+ </body>
18+
19+</html>

Comments

Sign in to comment.