Dockerfile 956 B

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