Download Dockerfile from ZHZ1024/dind: direct link, hf CLI and curl.
- Browser
- Download file 988 Bytes
-
https://huggingface.co/spaces/ZHZ1024/dind/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/ZHZ1024/dind/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/ZHZ1024/dind/resolve/main/Dockerfile
988 Bytes
| # 使用官方Node.js镜像作为基础 | |
| FROM node:18-alpine | |
| # 设置工作目录 | |
| WORKDIR /app | |
| # 安装必要的系统依赖 | |
| RUN apk add --no-cache git python3 make g++ | |
| # 设置淘宝镜像源(解决国内网络问题) | |
| RUN yarn config set registry https://registry.npmmirror.com | |
| # 只安装pm2(因为yarn已经预装) | |
| RUN npm install -g pm2 | |
| # 克隆项目 | |
| RUN git clone https://github.com/yinxin630/fiora.git -b master . && \ | |
| rm -rf .git | |
| # 安装项目依赖(增加重试机制) | |
| RUN yarn install --network-timeout 100000 || \ | |
| (yarn cache clean && yarn install --network-timeout 100000) | |
| # 构建客户端代码 | |
| RUN yarn build:web | |
| # 创建.env文件(生产环境应该使用环境变量或secrets) | |
| RUN echo "JwtSecret=your_random_secret_here" > .env | |
| # 暴露端口 | |
| EXPOSE 9200 | |
| # 使用pm2启动应用 | |
| CMD ["pm2-runtime", "start", "yarn", "--", "start"] | |
| # 健康检查 | |
| HEALTHCHECK --interval=30s --timeout=10s \ | |
| CMD curl -f http://localhost:9200 || exit 1 |