code: def test_dockerfile_example(dockerfile):
      rel_dockerfile_path = Path(dockerfile).relative_to(
          DOCKER_EXAMPLES_DIR
      )
      image_name = str(rel_dockerfile_path).lower().replace("/", "-")
      content = Path(dockerfile).read_text()
      test_image = os.environ.get(
          "TEST_IMAGE", get_latest_airflow_image()
      )
      new_content = re.sub(
          r"FROM apache/airflow:.*", rf"FROM {test_image}", content
      )
      try:
          run_command(
              ["docker", "build", ".", "--tag", image_name, "-f", "-"],
              cwd=str(Path(dockerfile).parent),
              input=new_content.encode(),
          )
      finally:
          run_command(["docker", "rmi", "--force", image_name])
  
file_path: airflow/docker_tests/test_examples_of_prod_image_building.py
imports: from __future__ import annotations
  import glob
  import os
  import re
  from functools import lru_cache
  from pathlib import Path
  import pytest
  import requests
  from docker_tests.command_utils import run_command
  from docker_tests.constants import SOURCE_ROOT
label_desc: Use image node_id 3 for calling a global function with example usage: test_dockerfile_example(dockerfile) without return types