mirror of
https://gitlab.com/stilobique/blender-docker.git
synced 2026-05-28 04:37:47 +02:00
Basic script to start the docker cache repo
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Make Blender Cache" type="PythonConfigurationType" factoryName="Python">
|
||||
<module name="blender-docker" />
|
||||
<option name="INTERPRETER_OPTIONS" value="" />
|
||||
<option name="PARENT_ENVS" value="true" />
|
||||
<envs>
|
||||
<env name="PYTHONUNBUFFERED" value="1" />
|
||||
</envs>
|
||||
<option name="SDK_HOME" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
|
||||
<option name="IS_MODULE_SDK" value="true" />
|
||||
<option name="ADD_CONTENT_ROOTS" value="true" />
|
||||
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/generate-image-repo.py" />
|
||||
<option name="PARAMETERS" value="" />
|
||||
<option name="SHOW_COMMAND_LINE" value="false" />
|
||||
<option name="EMULATE_TERMINAL" value="false" />
|
||||
<option name="MODULE_MODE" value="false" />
|
||||
<option name="REDIRECT_INPUT" value="false" />
|
||||
<option name="INPUT_FILE" value="" />
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
</component>
|
||||
+15
-11
@@ -13,20 +13,24 @@ def get_repo_container():
|
||||
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'
|
||||
dk_tags = 'stilobique/csv'
|
||||
dk_container_name = 'blender-cache-repo'
|
||||
dk_images_local = client.images.list(name=dk_tags)
|
||||
dk_containers_local = client.containers.list(filters={'label': dk_container_name})
|
||||
|
||||
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)
|
||||
if dk_containers_local:
|
||||
# The container cache exist, used-it
|
||||
client.containers.run(image=dk_tags, name=dk_container_name)
|
||||
pass
|
||||
elif dk_images_local:
|
||||
# No container, but the image are build, start a container cache
|
||||
client.containers.run(image=dk_tags, name=dk_container_name)
|
||||
pass
|
||||
|
||||
else:
|
||||
client.containers.run(image=docker_tags, name=docker_container_name)
|
||||
# No container, no image ; build a new image and start this cache
|
||||
client.images.build(path="image", dockerfile="Dockerfile-csv", tag=f'{dk_tags}:latest', rm=True)
|
||||
client.containers.run(image=dk_tags, name=dk_container_name)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user