def METHOD_NAME(vm):
  """Builds the Docker images from source Dockerfiles for a pre-built env."""
  vm.InstallPackages('git')
  vm.RemoteHostCommand('cd {0} && git clone -b {1} '
                       'https://github.com/tensorflow/serving'.format(
                           linux_packages.INSTALL_DIR, FLAGS.tf_serving_branch))
  setup_script = posixpath.join(
      linux_packages.INSTALL_DIR,
      'serving/tensorflow_serving/tools/docker/Dockerfile.devel')
  # Changes the TensorFlow git branch to tf_serving_branch
  vm_util.ReplaceText(vm, 'ARG TF_SERVING_VERSION_GIT_BRANCH=master',
                      'ARG TF_SERVING_VERSION_GIT_BRANCH={}'
                      .format(FLAGS.tf_serving_branch), setup_script)
  # Build an optimized binary for TF Serving, and keep all the build artifacts
  vm.RemoteHostCommand(
      'sudo docker build --target binary_build '
      '-t benchmarks/tensorflow-serving-devel '
      '-f {0}/tensorflow_serving/tools/docker/Dockerfile.devel '
      '{0}/tensorflow_serving/tools/docker/'.format(TF_SERVING_BASE_DIRECTORY))
  # Create a serving image with the optimized model_server binary
  vm.RemoteHostCommand(
      'sudo docker build '
      '-t benchmarks/tensorflow-serving '
      '--build-arg '
      'TF_SERVING_BUILD_IMAGE=benchmarks/tensorflow-serving-devel '
      '-f {0}/tensorflow_serving/tools/docker/Dockerfile '
      '{0}/tensorflow_serving/tools/docker/'.format(TF_SERVING_BASE_DIRECTORY))