# Base image
FROM <OS_IMAGE>
# Install dependencies
RUN zypper --gpg-auto-import-keys ref -s && \
zypper -n install git net-tools libnuma1
# Create temp user
RUN useradd -ms /bin/bash userapp
# Creating all the required folders that is required for installment.
RUN mkdir -p /home/folder1/
RUN mkdir -p /home/folder2/
RUN sudo pip install --upgrade pip
RUN python3 code_which_takes_time.py
# Many more stuff below this.
所以
code_which_takes_time.py
运行需要时间,它会下载很多东西并执行。
因此,只要我们在下面添加更多语句,就需要满足这一要求
RUN python3 code_which_takes_time.py
每次在构建映像时都将执行此python脚本。
所以我想把这张图片分成两个DockerFile。