Add helper to check docker environment

This commit is contained in:
amcmanu3 2023-02-12 12:28:37 -05:00
parent c151e5f3a7
commit fdf7bd7621

View File

@ -987,6 +987,15 @@ class Helpers:
def is_os_windows():
return os.name == "nt"
@staticmethod
def is_env_docker():
path = "/proc/self/cgroup"
return (
os.path.exists("/.dockerenv")
or os.path.isfile(path)
and any("docker" in line for line in open(path, encoding="utf-8"))
)
@staticmethod
def wtol_path(w_path):
l_path = w_path.replace("\\", "/")