File size: 834 Bytes
8dd4269
 
39a877f
8dd4269
 
39a877f
8dd4269
 
39a877f
8dd4269
 
39a877f
8dd4269
 
39a877f
8dd4269
 
39a877f
8dd4269
 
39a877f
8dd4269
 
39a877f
8dd4269
 
39a877f
8dd4269
 
39a877f
8dd4269
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# 使用 Alpine Linux 作为基础镜像,并命名为 builder 阶段
FROM alpine AS builder

# 安装必要的软件包(Node.js、npm 和 Git)
RUN apk add --no-cache nodejs npm git

# 升级全局安装的 npm 到最新版本
RUN npm install npm -g

# 创建名为 app 的非交互式用户
RUN adduser -D app

# 切换用户为 app,后续命令将以该用户身份执行
USER app

# 设置工作目录为 /home/app
WORKDIR /home/app

# 在 /home/app 目录下克隆指定的 Git 仓库
RUN git clone https://github.com/louislam/uptime-kuma.git

# 设置工作目录为 /home/app/uptime-kuma
WORKDIR /home/app/uptime-kuma

# 在 uptime-kuma 项目目录下运行 npm 脚本 setup
RUN npm run setup

# 声明容器将监听的端口
EXPOSE 3001

# 指定容器启动时要运行的默认命令
CMD ["node", "server/server.js"]