Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _start_run_deps(self):
"""Starts the containers that are marked as runtime dependencies."""
for (run_dep_image, run_dep_name) in self.run_deps:
run_dep_instance = DockerInstance(
instance_name=run_dep_name,
image_name=run_dep_image,
run_command=None,
docker_command=None,
dockerfile=None,
repository=None,
directory=None,
command=None,
volumes=None,
ports=None,
network=self.network,
run_deps=None,
docker_compose_file=None,
docker_compose_command=None,
docker_compose_project_name=None,
docker_compose_services=None,
def from_config(cls):
config = cls._config_from_file()
config.update(cls._config_from_environment())
return DockerInstance(
instance_name=config.get("DAZEL_INSTANCE_NAME", DEFAULT_INSTANCE_NAME),
image_name=config.get("DAZEL_IMAGE_NAME", DEFAULT_IMAGE_NAME),
run_command=config.get("DAZEL_RUN_COMMAND", DEFAULT_RUN_COMMAND),
docker_command=config.get("DAZEL_DOCKER_COMMAND", DEFAULT_DOCKER_COMMAND),
dockerfile=config.get("DAZEL_DOCKERFILE", DEFAULT_LOCAL_DOCKERFILE),
repository=config.get("DAZEL_REPOSITORY", DEFAULT_REMOTE_REPOSITORY),
directory=config.get("DAZEL_DIRECTORY", DEFAULT_DIRECTORY),
command=config.get("DAZEL_COMMAND", DEFAULT_COMMAND),
volumes=config.get("DAZEL_VOLUMES", DEFAULT_VOLUMES),
ports=config.get("DAZEL_PORTS", DEFAULT_PORTS),
env_vars=config.get("DAZEL_ENV_VARS", DEFAULT_ENV_VARS),
network=config.get("DAZEL_NETWORK", DEFAULT_NETWORK),
run_deps=config.get("DAZEL_RUN_DEPS", DEFAULT_RUN_DEPS),
docker_compose_file=config.get("DAZEL_DOCKER_COMPOSE_FILE",
DEFAULT_DOCKER_COMPOSE_FILE),
docker_compose_command=config.get("DAZEL_DOCKER_COMPOSE_COMMAND",
def main():
# Read the configuration either from .dazelrc or from the environment.
di = DockerInstance.from_config()
# If there is no .dazel_run file, or it is too old, start the DockerInstance.
if (not os.path.exists(di.dazel_run_file) or
not di.is_running() or
(os.path.exists(di.dockerfile) and
os.path.getctime(di.dockerfile) > os.path.getctime(di.dazel_run_file))):
rc = di.start()
if rc:
return rc
# Forward the command line arguments to the container.
return di.send_command(sys.argv[1:])