File tree Expand file tree Collapse file tree 3 files changed +56
-2
lines changed Expand file tree Collapse file tree 3 files changed +56
-2
lines changed Original file line number Diff line number Diff line change 1
1
FROM node:14.16.1-alpine AS build
2
2
3
- RUN npm config set registry https://registry.npm.taobao.org/
3
+ RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories
4
+ RUN apk add --no-cache ca-certificates python3 py3-pip
5
+ RUN apk add --no-cache tzdata \
6
+ && cp /usr/share/zoneinfo/Asia/Chongqing /etc/localtime \
7
+ && echo "Asia/Chongqing" > /etc/timezone
8
+ RUN apk add --no-cache make g++
9
+
10
+
11
+
12
+ RUN npm config set registry https://registry.npmmirror.com
4
13
# 设置目录
5
14
RUN mkdir -p /app/data /app/server /app/client/dist /app/docker
6
15
@@ -16,7 +25,6 @@ ADD client/dist /app/client/dist
16
25
WORKDIR /app/server
17
26
ADD server /app/server
18
27
RUN npm install
19
-
20
28
EXPOSE 8081/tcp
21
29
22
30
ENTRYPOINT ["/app/docker/docker-entrypoint.sh" ]
Original file line number Diff line number Diff line change @@ -80,8 +80,23 @@ npm run start #本地运行可以使用该命令
80
80
81
81
4.使用浏览器打开进入http://localhost:8081即可进入应用
82
82
83
+ # Docker部署
84
+ ### 构建镜像
85
+ ```
86
+ docker build . -t appspace
87
+ ```
83
88
89
+ ### 使用 compose 运行
90
+ ```
91
+ # 启动
92
+ docker compose up -d
84
93
94
+ # 停止
95
+ docker compose stop
96
+
97
+ # 停止并删除容器(包括数据)
98
+ docker compose down --remove-orphans
99
+ ```
85
100
86
101
### 项目配置说明
87
102
Original file line number Diff line number Diff line change
1
+ services :
2
+ appspace-mongo :
3
+ container_name : appspace-mongo
4
+ image : mongo:6.0
5
+ restart : unless-stopped
6
+ ports :
7
+ - 127.0.0.1:27017:27017
8
+ environment :
9
+ - MONGO_INITDB_ROOT_USERNAME=root
10
+ - MONGO_INITDB_ROOT_PASSWORD=root
11
+
12
+ appspace :
13
+ container_name : appspace
14
+ image : appspace
15
+ restart : always
16
+ ports :
17
+ - ' 8081:8081'
18
+ environment :
19
+ APP_SPA_DOMAIN : http://example.com
20
+ APP_SPA_SECRET : abcdefg
21
+ APP_SPA_DBUSER : root
22
+ APP_SPA_DBPWD : root
23
+ APP_SPA_DB_NAME : app_space
24
+ APP_SPA_DB_HOST : appspace-mongo
25
+ APP_SPA_DB_PORT : 27017
26
+ APP_SPA_ADMIN_ACCOUNT : admin
27
+ APP_SPA_ADMIN_PASSWORD : " app@space"
28
+
29
+
30
+ # volumes:
31
+ # dbdata:
You can’t perform that action at this time.
0 commit comments