diff --git a/.github/workflows/build_images.yml b/.github/workflows/build_images.yml index ec1feed..de2abf8 100644 --- a/.github/workflows/build_images.yml +++ b/.github/workflows/build_images.yml @@ -21,9 +21,12 @@ jobs: - uses: actions/checkout@v3 with: ref: refs/heads/main - - name: Free Disk Space + #- name: Free Disk Space + # run: | + # ./free_disk_space.sh + - name: Store Docker Images on /mnt/docker run: | - ./free_disk_space.sh + ./docker.py - name: Login to DockerHub uses: docker/login-action@v3 with: @@ -31,9 +34,9 @@ jobs: password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Build Docker Images run: | - df -lh - docker ps + #df -lh + #docker ps ./build_images.py --branch '${{ github.event.inputs.branch }}' --repo '${{ github.event.inputs.repo }}' --root-image-name '${{ github.event.inputs.root_image_name }}' cat graph.yaml - docker ps - df -lh + #docker ps + #df -lh diff --git a/docker.py b/docker.py new file mode 100755 index 0000000..b74ad59 --- /dev/null +++ b/docker.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python3 +import json +from pathlib import Path +import subprocess as sp + + +def config_data_root(data_root: str) -> dict[str, str]: + Path(data_root).mkdir(parents=True, exists_ok=True) + settings = {} + path = Path("/etc/docker/daemon.json") + if path.is_file(): + with path.open("r", encoding="utf-8") as fin: + settings = json.load(fin) + settings["data-root"] = data_root + with path.open("w", encoding="utf-8") as fout: + json.dump(settings, fout, indent=4) + return settings + + +def store_docker_on_mnt(): + sp.run(cmd="systemctl stop docker", shell=True, check=True) + settings = config_data_root("/mnt/docker") + print(settings) + sp.run(cmd="systemctl start docker", shell=True, check=True) + sp.run(cmd="docker info", shell=True, check=True) + + +if __name__ == "__main__": + store_docker_on_mnt() +