#!/usr/bin/python3 from pathlib import Path from subprocess import call from datetime import datetime def main(): build_images() update_containers() def build_images(): images_str = Path('images.conf').read_text() images = images_str.split('\n') today = datetime.now().strftime('%Y%m%d') for image in images: path = Path('../images').joinpath(image) call(['docker', 'build', '--no-cache', f'--tag={image}:{today}', '.'], cwd=path) def update_containers(): containers_str = Path('container.conf').read_text() containers = containers_str.split('\n') for container in containers: path = Path('../container').joinpath(container) call(['docker-compose', 'pull'], cwd=path) call(['docker-compose', 'up', '-d'], cwd=path) if __name__ == "__main__": main()