image.png
    Dockerfile.cpu
    以该文件构建,可能会出现下载速度很慢的情况,可以修改下载源为国内的源;

    1. FROM tensorflow/tensorflow:2.0.0-py3
    2. # Install system packages
    3. RUN apt-get update && apt-get install -y --no-install-recommends \
    4. bzip2 \
    5. g++ \
    6. git \
    7. graphviz \
    8. libgl1-mesa-glx \
    9. libhdf5-dev \
    10. openmpi-bin \
    11. wget && \
    12. rm -rf /var/lib/apt/lists/*
    13. COPY src /src
    14. COPY entrypoints /src/entrypoints
    15. WORKDIR /src
    16. RUN pip install -r requirements.txt
    17. ENV PYTHONPATH='/src/:$PYTHONPATH'
    18. ENTRYPOINT ["entrypoints/entrypoint.train.cpu.sh"]

    image.png
    这个命令 nima-cpu后面的 “.” 句号,表示build过程的上下文上下文影响build过程的COPY指令/ADD指令等。

    # FROM指令, 基于xxx镜像构建当前镜像
    FROM tensorflow/tensorflow:2.0.0-py3
    # RUN指令, 执行shell命令
    RUN ...
    # 把上下文目录下的src目录下的文件,复制到镜像的/src目录下
    COPY src /src
    # 把上下文目录下的entrypoints目录下的文件,复制到镜像的/src/entrypoints目录下
    COPY entrypoints /src/entrypoints
    # WORKDIR指令, 指定后续RUN指令的当前目录(./), 相当于cd
    WORKDIR /src
    # 使用/src/下的requirements.txt执行pip
    RUN pip install -r requirements.txt
    # 指定容器的PYTHONPATH环境
    ENV PYTHONPATH='/src/:$PYTHONPATH'
    # 启动容器时的入口
    ENTRYPOINT ["entrypoints/entrypoint.train.cpu.sh"]