File tree 5 files changed +29
-6
lines changed
5 files changed +29
-6
lines changed Original file line number Diff line number Diff line change 1
1
# See http://help.github.com/ignore-files/ for more about ignoring files.
2
2
3
3
# compiled output
4
+ /data
4
5
/dist
5
6
/tmp
6
7
/out-tsc
Original file line number Diff line number Diff line change 1
1
FROM node:12.18.2
2
2
3
3
WORKDIR /usr/src/app
4
- COPY package.json .
5
- RUN npm i -g @angular/cli@~10.0.1 typescript@~3.9.6
6
- RUN npm i
4
+ COPY package*.json ./
5
+ RUN npm ci
7
6
COPY . .
8
- RUN tsc -p ./server && ng build --aot --prod
9
-
10
- CMD [ "npm" , "start" ]
7
+ ENV MONGODB_URI mongodb://mongo:27017/angularfullstack
8
+ RUN npm run predev && npm run buildprod
9
+ EXPOSE 3000
10
+ CMD [ "npm" , "start" ]
Original file line number Diff line number Diff line change @@ -31,6 +31,10 @@ A window will automatically open at [localhost:4200](http://localhost:4200). Ang
31
31
### Production mode
32
32
` npm run prod ` : run the project with a production bundle and AOT compilation listening at [ localhost:3000] ( http://localhost:3000 )
33
33
34
+ ### Docker
35
+ 1 . ` docker-compose up `
36
+ 2 . Go to [ localhost:3000] ( http://localhost:3000 )
37
+
34
38
## Preview
35
39
![ Preview] ( https://raw.githubusercontent.com/DavideViolante/Angular2-Full-Stack/master/demo.gif " Preview ")
36
40
Original file line number Diff line number Diff line change
1
+ version : " 2"
2
+ services :
3
+ app :
4
+ container_name : afs
5
+ restart : always
6
+ build : .
7
+ ports :
8
+ - " 3000:3000"
9
+ links :
10
+ - mongo
11
+ mongo :
12
+ container_name : mongo
13
+ image : mongo
14
+ volumes :
15
+ - ./data:/data/db
16
+ ports :
17
+ - " 27017:27017"
Original file line number Diff line number Diff line change 11
11
"scripts" : {
12
12
"ng" : " ng" ,
13
13
"build" : " ng build" ,
14
+ "buildprod" : " ng build --aot --prod" ,
14
15
"start" : " node dist/server/app.js" ,
15
16
"predev" : " tsc -p server" ,
16
17
"dev" : " concurrently \" mongod\" \" ng serve --proxy-config proxy.conf.json --open\" \" tsc -w -p server\" \" nodemon dist/server/app.js\" " ,
You can’t perform that action at this time.
0 commit comments