Skip to content

Build and run local images

Yang Yang edited this page Sep 8, 2020 · 1 revision

Build local images

Build latest tag

tools/build xud
# It's equvalant to xud:latest
tools/build xud:latest

Build version tag

tools/build xud:1.0.0

Sophisticated control over image source code by implementing your src.py

You could find the super class SourceManager under tools/core/src.py.

Example 1. Use another xud branch in latest tag

from tools.core import src

class SourceManager(src.SourceManager):
    def get_ref(self, version):
        if version == "latest":
            return "another-branch"
        else:
            return "v" + version

Example 2. Modify xud source code without pushing branch to xud repo

Directly make changes in images/xud/.src folder and bypass checkout in src.py

from tools.core import src

class SourceManager(src.SourceManager):
    def checkout_repo(self, repo_dir, ref):
        pass

Example 3. Build images from your forked xud repository

from tools.core import src

class SourceManager(src.SourceManager):
    def __init(self):
        super().__init__("https://github.com/your/xud")

Example 4. Build images from your local xud source code folder

from tools.core import src
import shutil

class SourceManager(src.SourceManager):
    def ensure(self, version):
        shutil.copytree("/path/to/xud", self.repo_dir)

Example 5. Don't use src.py and write your Dockerfile instead

Remove xud src.py and change Dockerfile to download xud source or add xud source from somewhere as you wish.

Use local images

bash setup.sh -b local --dev --use-local-images xud
  • --dev use local utils image
  • --use-local-images use other service images