mirror of
https://gitlab.sectorq.eu/home/docker-compose.git
synced 2025-12-15 18:54:54 +01:00
build
This commit is contained in:
@@ -23,7 +23,11 @@ def copy_to_volume(volume_name, source_dir, container_path="/data", image="busyb
|
||||
|
||||
if not os.path.isdir(source_dir):
|
||||
raise ValueError(f"Source directory {source_dir} does not exist")
|
||||
|
||||
if not os.listdir(source_dir):
|
||||
print("Folder is empty")
|
||||
return 1
|
||||
else:
|
||||
print("Folder is not empty")
|
||||
# Check if volume exists
|
||||
try:
|
||||
volume = client.volumes.get(volume_name)
|
||||
@@ -36,6 +40,7 @@ def copy_to_volume(volume_name, source_dir, container_path="/data", image="busyb
|
||||
print(f"Copying files from {source_dir} to volume '{volume_name}'...")
|
||||
|
||||
# Run temporary container to copy files
|
||||
print(container_path)
|
||||
client.containers.run(
|
||||
image,
|
||||
command=f"sh -c 'cp -r /tmp/* {container_path}/'",
|
||||
|
||||
Reference in New Issue
Block a user