File tree 6 files changed +84
-20
lines changed
6 files changed +84
-20
lines changed Original file line number Diff line number Diff line change
1
+ FROM node:22-alpine
2
+
3
+ # Create app directory
4
+ WORKDIR /usr/src/app
5
+
6
+ # Install app dependencies
7
+ COPY . .
8
+
9
+ RUN chmod +x .docker/build.sh && .docker/build.sh
10
+
11
+ ENV NODE_ENV=production \
12
+ EGG_SERVER_ENV=prod \
13
+ CNPMCORE_CONFIG_REGISTRY= \
14
+ CNPMCORE_CONFIG_SOURCE_REGISTRY=https://registry.npmmirror.com \
15
+ CNPMCORE_CONFIG_SOURCE_REGISTRY_IS_CNPM=true \
16
+ CNPMCORE_DATABASE_TYPE= \
17
+ CNPMCORE_DATABASE_NAME= \
18
+ CNPMCORE_DATABASE_HOST= \
19
+ CNPMCORE_DATABASE_PORT=3306 \
20
+ CNPMCORE_DATABASE_USER= \
21
+ CNPMCORE_DATABASE_PASSWORD= \
22
+ CNPMCORE_REDIS_HOST= \
23
+ CNPMCORE_REDIS_PORT=6379 \
24
+ CNPMCORE_REDIS_PASSWORD= \
25
+ CNPMCORE_REDIS_DB= \
26
+ CNPMCORE_NFS_TYPE=s3 \
27
+ CNPMCORE_NFS_S3_CLIENT_ENDPOINT= \
28
+ CNPMCORE_NFS_S3_CLIENT_BUCKET= \
29
+ CNPMCORE_NFS_S3_CLIENT_ID= \
30
+ CNPMCORE_NFS_S3_CLIENT_SECRET= \
31
+ CNPMCORE_NFS_S3_CLIENT_FORCE_PATH_STYLE=true \
32
+ CNPMCORE_NFS_S3_CLIENT_DISABLE_URL=true \
33
+ TZ=Asia/Shanghai
34
+
35
+ EXPOSE 7001
36
+ CMD ["npm" , "run" , "start:foreground" ]
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+
3
+ npm install -g npminstall --registry=https://registry.npmmirror.com \
4
+ && npminstall -c \
5
+ && npm run tsc \
6
+ && npmupdate -c --production
Original file line number Diff line number Diff line change
1
+ FROM node:22
2
+
3
+ # Create app directory
4
+ WORKDIR /usr/src/app
5
+
6
+ # Install app dependencies
7
+ COPY . .
8
+
9
+ RUN chmod +x .docker/build.sh && .docker/build.sh
10
+
11
+ ENV NODE_ENV=production \
12
+ EGG_SERVER_ENV=prod \
13
+ CNPMCORE_CONFIG_REGISTRY= \
14
+ CNPMCORE_CONFIG_SOURCE_REGISTRY=https://registry.npmmirror.com \
15
+ CNPMCORE_CONFIG_SOURCE_REGISTRY_IS_CNPM=true \
16
+ CNPMCORE_DATABASE_TYPE= \
17
+ CNPMCORE_DATABASE_NAME= \
18
+ CNPMCORE_DATABASE_HOST= \
19
+ CNPMCORE_DATABASE_PORT=3306 \
20
+ CNPMCORE_DATABASE_USER= \
21
+ CNPMCORE_DATABASE_PASSWORD= \
22
+ CNPMCORE_REDIS_HOST= \
23
+ CNPMCORE_REDIS_PORT=6379 \
24
+ CNPMCORE_REDIS_PASSWORD= \
25
+ CNPMCORE_REDIS_DB= \
26
+ CNPMCORE_NFS_TYPE=s3 \
27
+ CNPMCORE_NFS_S3_CLIENT_ENDPOINT= \
28
+ CNPMCORE_NFS_S3_CLIENT_BUCKET= \
29
+ CNPMCORE_NFS_S3_CLIENT_ID= \
30
+ CNPMCORE_NFS_S3_CLIENT_SECRET= \
31
+ CNPMCORE_NFS_S3_CLIENT_FORCE_PATH_STYLE=true \
32
+ CNPMCORE_NFS_S3_CLIENT_DISABLE_URL=true \
33
+ TZ=Asia/Shanghai
34
+
35
+ EXPOSE 7001
36
+ CMD ["npm" , "run" , "start:foreground" ]
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 3
3
## 构建镜像
4
4
5
5
``` bash
6
- docker build -t cnpmcore .
6
+ npm run images
7
7
```
8
8
9
9
## 通过环境变量配置参数
@@ -230,5 +230,6 @@ npm whoami --registry=https://registry-demo.fengmk2.com:9443
230
230
https://hub.docker.com/r/fengmk2/cnpmcore
231
231
232
232
``` bash
233
- docker pull fengmk2/cnpmcore
233
+ docker pull fengmk2/cnpmcore:latest
234
+ docker pull fengmk2/cnpmcore:latest-alpine
234
235
```
Original file line number Diff line number Diff line change 61
61
"tsc" : " npm run clean && tsc -p ./tsconfig.json" ,
62
62
"tsc:prod" : " npm run clean && tsc -p ./tsconfig.prod.json" ,
63
63
"prepublishOnly" : " npm run tsc:prod" ,
64
+ "images" : " npm run images:alpine && npm run images:debian" ,
65
+ "images:alpine" : " docker build -t cnpmcore:alpine-latest -f .docker/alpine/Dockerfile ." ,
66
+ "images:debian" : " docker build -t cnpmcore:latest -f .docker/debian/Dockerfile ." ,
64
67
"start" : " eggctl start --daemon && touch egg.status" ,
65
68
"start:foreground" : " eggctl start" ,
66
69
"stop" : " rm -f egg.status && sleep 15 && eggctl stop"
You can’t perform that action at this time.
0 commit comments