| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- FROM ubuntu:24.04
- # 安装必要的依赖
- RUN apt-get update && \
- apt-get install -y curl ca-certificates && \
- rm -rf /var/lib/apt/lists/*
- # 创建安装目录
- WORKDIR /opt/pipe
- # 下载最新的二进制文件
- RUN curl -L https://pipe.network/p1-cdn/releases/latest/download/pop -o pop && \
- chmod +x pop
- # 创建缓存目录
- RUN mkdir -p ./cache
- # 复制 .env 文件到容器
- COPY .env /opt/pipe/.env
- # 暴露端口
- # 80: HTTP
- # 443: HTTPS
- # 8081: Health check
- # 9090: Prometheus metrics
- EXPOSE 80 443 8081 9090
- # 创建启动脚本(直接使用复制进来的 .env 文件)
- RUN echo '#!/bin/bash\n\
- set -e\n\
- # 加载 .env 文件中的环境变量并运行\n\
- source .env && exec ./pop\n\
- ' > /opt/pipe/start.sh && chmod +x /opt/pipe/start.sh
- # 健康检查
- HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
- CMD curl -f http://localhost:8081/health || exit 1
- # 启动命令
- CMD ["/opt/pipe/start.sh"]
|