remove trailing whitespaces from generated Dockerfile

pull/34/head
oliverpool 2021-12-08 16:14:02 +01:00
rodzic 9ee23b3959
commit 69ee700f96
1 zmienionych plików z 13 dodań i 13 usunięć

Wyświetl plik

@ -44,9 +44,9 @@ def create_dockerfile(base_os: str,
""" """
Create a stringified Dockerfile based on arguments provided Create a stringified Dockerfile based on arguments provided
""" """
dockerfile = "# Dockerfile autogenerated on {} by {} \n".format( dockerfile = "# Dockerfile autogenerated on {} by {}\n".format(
datetime.now().strftime("%m/%d/%Y, %H:%M:%S"), getpass.getuser()) datetime.now().strftime("%m/%d/%Y, %H:%M:%S"), getpass.getuser())
dockerfile += "# Please do not edit this file directly \n\n" dockerfile += "# Please do not edit this file directly\n\n"
dockerfile += "FROM {}\n\n".format(base_os) dockerfile += "FROM {}\n\n".format(base_os)
dockerfile += "LABEL Author=\"{}\"\n".format(author) dockerfile += "LABEL Author=\"{}\"\n".format(author)
@ -58,7 +58,7 @@ def create_dockerfile(base_os: str,
dockerfile += "\n" dockerfile += "\n"
dockerfile += "# Install dependencies\n" dockerfile += "# Install dependencies\n"
dockerfile += "RUN apt-get update && apt-get install -y \ \n" dockerfile += "RUN apt-get update && apt-get install -y \\\n"
archivetype = blender_download_url.split(".")[-1] archivetype = blender_download_url.split(".")[-1]
archiveflags = "xjvf" archiveflags = "xjvf"
@ -78,29 +78,29 @@ def create_dockerfile(base_os: str,
dockerfile += "\n" dockerfile += "\n"
dockerfile += "# Download and install Blender\n" dockerfile += "# Download and install Blender\n"
dockerfile += "RUN wget {} \ \n".format(blender_download_url) dockerfile += "RUN wget {} \\\n".format(blender_download_url)
dockerfile += "\u0009&& tar -{} {} --strip-components=1 -C /bin \ \n".format( dockerfile += "\u0009&& tar -{} {} --strip-components=1 -C /bin \\\n".format(
archiveflags, blender_download_url.split("/")[-1]) archiveflags, blender_download_url.split("/")[-1])
dockerfile += "\u0009&& rm -rf {} \ \n".format( dockerfile += "\u0009&& rm -rf {} \\\n".format(
blender_download_url.split("/")[-1]) blender_download_url.split("/")[-1])
dockerfile += "\u0009&& rm -rf {} \n\n".format( dockerfile += "\u0009&& rm -rf {}\n\n".format(
blender_download_url.split("/")[-1].split(".tar."+archivetype)[0]) blender_download_url.split("/")[-1].split(".tar."+archivetype)[0])
dockerfile += "# Download the Python source since it is not bundled with Blender\n" dockerfile += "# Download the Python source since it is not bundled with Blender\n"
dockerfile += "RUN wget {} \ \n".format(python_download_url) dockerfile += "RUN wget {} \\\n".format(python_download_url)
dockerfile += "\u0009&& tar -xzf {} \ \n".format( dockerfile += "\u0009&& tar -xzf {} \\\n".format(
python_download_url.split("/")[-1]) python_download_url.split("/")[-1])
dockerfile += "\u0009&& cp -r {}/Include/* $BLENDER_PATH/python/include/{}/ \ \n".format( dockerfile += "\u0009&& cp -r {}/Include/* $BLENDER_PATH/python/include/{}/ \\\n".format(
python_download_url.split("/")[-1].split('.tgz')[0], python_download_url.split("/")[-1].split('.tgz')[0],
python_version python_version
) )
dockerfile += "\u0009&& rm -rf {} \ \n".format( dockerfile += "\u0009&& rm -rf {} \\\n".format(
python_download_url.split("/")[-1]) python_download_url.split("/")[-1])
dockerfile += "\u0009&& rm -rf {} \n\n".format( dockerfile += "\u0009&& rm -rf {}\n\n".format(
python_download_url.split("/")[-1].split('.tgz')[0]) python_download_url.split("/")[-1].split('.tgz')[0])
dockerfile += "# Blender comes with a super outdated version of numpy (which is needed for matplotlib / opencv) so override it with a modern one\n" dockerfile += "# Blender comes with a super outdated version of numpy (which is needed for matplotlib / opencv) so override it with a modern one\n"
dockerfile += "RUN rm -rf {}/python/lib/{}/site-packages/numpy \n\n".format( dockerfile += "RUN rm -rf {}/python/lib/{}/site-packages/numpy\n\n".format(
"${BLENDER_PATH}", python_version) "${BLENDER_PATH}", python_version)
dockerfile += "# Must first ensurepip to install Blender pip3 and then new numpy\n" dockerfile += "# Must first ensurepip to install Blender pip3 and then new numpy\n"