File tree 5 files changed +64
-0
lines changed
5 files changed +64
-0
lines changed Original file line number Diff line number Diff line change
1
+ .idea /
Original file line number Diff line number Diff line change
1
+ FROM node:18.8.0-alpine
2
+
3
+ WORKDIR app_work_dir
4
+ ADD . /app_work_dir
5
+
6
+ RUN npm install
7
+ EXPOSE 5050
8
+
9
+ ENTRYPOINT ["npm" , "run" ]
10
+ CMD ["start" ]
Original file line number Diff line number Diff line change
1
+ # NodeJS应用示例
2
+
3
+ ## 本地运行
4
+
5
+ ``` sh
6
+ $ git clone https://github.com/sinacloud/nodejs-getting-started-dockerfile.git
7
+ $ cd nodejs-getting-started-dockerfile
8
+ $ npm install
9
+ $ npm start
10
+ ```
11
+
12
+ 现在,本示例应用已经跑在了你的 localhost:5050 端口上了。
13
+
14
+ ## 部署到sinacloud
15
+
16
+ 首先,提交代码到你的sinacloud应用的git仓库。
17
+
18
+
19
+ 登陆sinacloud容器云的管理页面,在运行环境管理-代码管理-如何部署查看部署代码方式。
20
+
21
+ 部署完成之后,你就可以通过 http://$APPNAME.saelinzi.com 来访问你的应用了。
22
+ ```
23
+ 如果您的应用显示未激活,您需要设置host才能访问,设置方法参见应用的管理页面
24
+ ```
25
+
26
+ ## 相关文档
Original file line number Diff line number Diff line change
1
+ var express = require ( 'express' )
2
+ var app = express ( )
3
+
4
+ app . get ( '/' , function ( req , res ) {
5
+ res . send ( 'Hello SAE NodeJS' )
6
+ } )
7
+
8
+ app . listen ( process . env . PORT || 5050 )
Original file line number Diff line number Diff line change
1
+ {
2
+ "name" : " nodejs-getting-started-dockerfile" ,
3
+ "description" : " getting started with nodejs on sinacloud platform" ,
4
+ "version" : " 0.0.1" ,
5
+ "private" : true ,
6
+ "author" : {
7
+ "name" : " sae" ,
8
+ "email" : " saemail@sina.cn"
9
+ },
10
+ "dependencies" : {
11
+ "express" : " ^4.13.3"
12
+ },
13
+ "engines" : {
14
+ "node" : " v18.8.0"
15
+ },
16
+ "scripts" : {
17
+ "start" : " node index.js"
18
+ }
19
+ }
You can’t perform that action at this time.
0 commit comments