Add setup about the blender cache container

This commit is contained in:
2023-02-24 01:31:05 +01:00
parent 776c8f77b4
commit 6b469cf158
5 changed files with 54 additions and 2 deletions
+35
View File
@@ -0,0 +1,35 @@
import docker
import os
def get_repo_container():
"""
- Check if a blender/csv image local exist
- If yes, check if a container exist
:return:
"""
client = docker.from_env()
if os.environ.get('docker_hub_password'):
client.login(username=os.environ['docker_hub_user'], password=os.environ['docker_hub_password'])
docker_tags = 'stilobique/csv'
docker_images_local = client.images.list(name=docker_tags)
docker_container_name = 'blender-cache-repo'
if docker_images_local:
docker_containers_local = client.containers.list()
if docker_containers_local:
# check the container
pass
else:
client.containers.run(image=docker_tags, name=docker_container_name)
else:
client.containers.run(image=docker_tags, name=docker_container_name)
if __name__ == "__main__":
# Make or update the docker container
get_repo_container()
print('Blender repo set')