dockerfile_armv7.txt 3.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. # 基于的基础镜像-在dockerhub找
  2. FROM python:3.7-slim-buster
  3. # 添加描述信息
  4. MAINTAINER python3.7+drpy+supervisord by "hjdhnx" for armv7
  5. # 设置app文件夹是工作目录
  6. WORKDIR /root/sd/pywork/dr_py
  7. # 复制文件及目录过去
  8. COPY . /root/sd/pywork/dr_py
  9. # 配置一下国内的agt源
  10. # 移动旧的源
  11. RUN cp /etc/apt/sources.list /etc/apt/sources.list.bac
  12. # 更换国内源 bullseye debian11 https://mirrors.bfsu.edu.cn/help/debian/
  13. # RUN cat <<EOF > /etc/apt/sources.list
  14. # # 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
  15. # deb https://mirrors.bfsu.edu.cn/debian/ bullseye main contrib non-free
  16. # # deb-src https://mirrors.bfsu.edu.cn/debian/ bullseye main contrib non-free
  17. # deb https://mirrors.bfsu.edu.cn/debian/ bullseye-updates main contrib non-free
  18. # # deb-src https://mirrors.bfsu.edu.cn/debian/ bullseye-updates main contrib non-free
  19. #
  20. # deb https://mirrors.bfsu.edu.cn/debian/ bullseye-backports main contrib non-free
  21. # # deb-src https://mirrors.bfsu.edu.cn/debian/ bullseye-backports main contrib non-free
  22. #
  23. # deb https://mirrors.bfsu.edu.cn/debian-security bullseye-security main contrib non-free
  24. # # deb-src https://mirrors.bfsu.edu.cn/debian-security bullseye-security main contrib non-free
  25. # EOF
  26. RUN mkdir -p /etc/autostart
  27. ADD sources.list /etc/apt/
  28. ADD app.sh /etc/autostart/
  29. # RUN sed -i s@/archive.ubuntu.com/@/mirrors.aliyun.com/@g /etc/apt/sources.list
  30. # armv7安装gcc
  31. # RUN apt-get install gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf -y
  32. RUN chmod +x /etc/autostart/app.sh && apt-get clean && apt-get update
  33. RUN apt-get install python3-lxml -y
  34. # 执行指令,换源并安装依赖 设置默认pip源
  35. RUN pip install -i https://mirrors.cloud.tencent.com/pypi/simple --upgrade pip \
  36. && pip config set global.index-url https://mirrors.cloud.tencent.com/pypi/simple \
  37. && pip config set global.extra-index-url https://www.piwheels.org/simple
  38. # armv7专用
  39. RUN pip install ./whl/gevent-21.12.0-cp37-cp37m-linux_armv7l.whl
  40. # RUN pip install --upgrade gevent --no-cache-dir
  41. # RUN pip install ./whl/gevent-21.12.0-cp37-cp37m-linux_armv7l.whl
  42. # 执行指令,安装依赖
  43. RUN pip install -r requirements.txt
  44. # 安装vim编辑器
  45. RUN apt-get install -y vim
  46. # 切换容器时区
  47. RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo 'Asia/Shanghai' >/etc/timezone
  48. # 设置语言支持中文打印
  49. ENV LANG C.UTF-8
  50. ENV LC_ALL C.UTF-8
  51. EXPOSE 5705 9001
  52. # docker build -f dockerfile -t hjdhnx/drpy:mini . 构建命令,非此文件内命令
  53. # docker build -f dockerfile -t hjdhnx/drpy_mini . 构建命令,非此文件内命令
  54. # docker build -f dockerfile -t hjdhnx/drpy_mini . 构建命令,非此文件内命令
  55. # docker push hjdhnx/drpy_mini
  56. # docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -f dockerfile_armv7.txt -t hjdhnx/drpy:mini_arm64 .
  57. # docker buildx build --platform linux/arm/v7 -f dockerfile_armv7.txt -t hjdhnx/drpy_armv7 .
  58. # docker buildx build --platform linux/arm/v7 -f dockerfile_armv7.txt -t hjdhnx/drpy:armv7 --push .
  59. # 启动命令,非此文件内命令
  60. # docker run -it -p 5705:5705 -p 9001:9001 -v /home/pywork/dr_py:/root/sd/pywork/dr_py --restart=always --name drpy -d hjdhnx/drpy:mini
  61. # docker run -it -p 5705:5705 -p 9001:9001 -v /home/pywork/dr_py:/root/sd/pywork/dr_py --restart=always --name drpy -d hjdhnx/drpy_mini
  62. # ENV LC_ALL=zh_CN.utf8
  63. # ENV LANG=zh_CN.utf8
  64. # ENV LANGUAGE=zh_CN.utf8
  65. # RUN localedef -c -f UTF-8 -i zh_CN zh_CN.utf8
  66. # 执行命令
  67. # CMD [ "python", "/root/sd/pywork/dr_py/app.py" ]
  68. # supervisord -c /root/sd/pywork/dr_py/super/flask.conf
  69. # CMD [ "supervisord","-c", "/root/sd/pywork/dr_py/super/flask.conf" ]
  70. # ENTRYPOINT supervisord -c /root/sd/pywork/dr_py/super/flask.conf
  71. # ENTRYPOINT -c /root/sd/pywork/dr_py/super/flask.conf
  72. # CMD /bin/bash
  73. # 启动容器时,执行脚本
  74. ENTRYPOINT ["/etc/autostart/app.sh","flask"]
  75. # CMD supervisord -c /root/sd/pywork/dr_py/super/flask.conf && /bin/bash