diff options
author | flu0r1ne <flu0r1ne@flu0r1ne.net> | 2023-09-14 22:17:25 -0500 |
---|---|---|
committer | flu0r1ne <flu0r1ne@flu0r1ne.net> | 2023-09-14 22:18:18 -0500 |
commit | 71b0e296f725baf501b4af81cf82dd1aad428003 (patch) | |
tree | 3046f63a0317e84488b1ad18cb80f670a21bab71 | |
parent | e79083ce6568b77ccf6336b6d0f4b312daf70249 (diff) | |
download | rbuild-71b0e296f725baf501b4af81cf82dd1aad428003.tar.xz rbuild-71b0e296f725baf501b4af81cf82dd1aad428003.zip |
Provide an option to build multiple compose files within a single call
-rw-r--r-- | README.md | 14 | ||||
-rw-r--r-- | rbuild.py | 10 |
2 files changed, 13 insertions, 11 deletions
@@ -85,21 +85,21 @@ WantedBy=timers.target ## Usage ``` -usage: rbuild.py [-h] [--build-period BUILD_PERIOD] [--up-timeout-period UP_TIMEOUT_PERIOD] [--force-rebuild] [--remove-images] filename +usage: rbuild.py [-h] [--build-period BUILD_PERIOD] [--up-timeout-period UP_TIMEOUT_PERIOD] [--force-rebuild] [--remove-images] filename [filename ...] -Automatically rebuild a series of containers using Docker Compose. +Automatically rebuild a series of containers with docker compose. positional arguments: filename The docker-compose file to use. options: - -h, --help Show this help message and exit. + -h, --help show this help message and exit --build-period BUILD_PERIOD - Rebuild period in seconds. + Time images are allowed to live (in seconds.) --up-timeout-period UP_TIMEOUT_PERIOD - Timeout period for bringing up containers in seconds. - --force-rebuild Force a rebuild of all containers. - --remove-images Remove all existing images. + Up timeout period in seconds. + --force-rebuild Force all containers to be rebuilt + --remove-images Remove all images ``` ## License @@ -164,7 +164,7 @@ if __name__ == '__main__': parser = argparse.ArgumentParser(description='Automatically rebuild a series of containers with docker compose.') - parser.add_argument('filename', type=str, help='The docker-compose file to use.') + parser.add_argument('filename', type=str, nargs='+', help='The docker-compose file to use.') parser.add_argument('--build-period', type=int, default=BUILD_TTL, help='Time images are allowed to live (in seconds.)') parser.add_argument('--up-timeout-period', type=int, default=UP_TIMEOUT_PERIOD, help='Up timeout period in seconds.') @@ -185,8 +185,10 @@ if __name__ == '__main__': if args.remove_images and args.force_rebuild: die("Error: --remove-images cannot be used with --force-rebuild") - if args.remove_images: - remove_main(args.filename) + for filename in args.filename: - build_main(args.filename, force_rebuild=args.force_rebuild) + if args.remove_images: + remove_main(filename) + + build_main(filename, force_rebuild=args.force_rebuild) |