ZHZ1024 commited on
Commit
41e89c2
·
verified ·
1 Parent(s): 26a134b

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +29 -10
Dockerfile CHANGED
@@ -1,13 +1,32 @@
1
- FROM docker:dind
 
2
 
3
- # 1. 配DinD
4
- RUN mkdir -p /etc/docker && echo '{"storage-driver":"overlay2"}' > /etc/docker/daemon.json
5
 
6
- # 2. 安装必要工具
7
- RUN apk add --no-cache bash curl
8
 
9
- # 3. 启动脚本
10
- COPY entrypoint.sh /usr/local/bin/
11
- RUN chmod +x /usr/local/bin/entrypoint.sh
12
- USER root
13
- ENTRYPOINT ["entrypoint.sh"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # 使用官方Node.js镜像作为基础
2
+ FROM node:18-alpine
3
 
4
+ # 工作目录
5
+ WORKDIR /app
6
 
7
+ # 安装pm2全局
8
+ RUN npm install -g pm2 yarn
9
 
10
+ # 克隆项目
11
+ RUN apk add --no-cache git && \
12
+ git clone https://github.com/yinxin630/fiora.git -b master . && \
13
+ rm -rf .git
14
+
15
+ # 安装项目依赖
16
+ RUN yarn install
17
+
18
+ # 构建客户端代码
19
+ RUN yarn build:web
20
+
21
+ # 创建.env文件并设置JwtSecret(注意:生产环境应该使用更安全的方式管理密钥)
22
+ RUN echo "JwtSecret=your_random_secret_here" > .env
23
+
24
+ # 暴露端口
25
+ EXPOSE 9200
26
+
27
+ # 使用pm2启动应用
28
+ CMD ["pm2-runtime", "start", "yarn", "--", "start"]
29
+
30
+ # 健康检查
31
+ HEALTHCHECK --interval=30s --timeout=10s \
32
+ CMD curl -f http://localhost:9200 || exit 1