diff --git a/tljh-voila-gallery/tljh_voila_gallery/install_builder_units.py b/tljh-voila-gallery/tljh_voila_gallery/install_builder_units.py index 340c26b..77f00a9 100644 --- a/tljh-voila-gallery/tljh_voila_gallery/install_builder_units.py +++ b/tljh-voila-gallery/tljh_voila_gallery/install_builder_units.py @@ -1,8 +1,12 @@ +import os import sys from pkg_resources import resource_stream from tljh import systemd +GALLERY_REPO = os.environ.get('GALLERY_REPO', 'git+https://github.com/voila-gallery/gallery@master#"egg=tljh-voila-gallery&subdirectory=tljh-voila-gallery"') + + def ensure_builder_units(): gallery_builder_service = 'tljh-voila-gallery-builder.service' with resource_stream(__name__, f'./systemd-units/{gallery_builder_service}') as f: @@ -14,6 +18,7 @@ def ensure_builder_units(): unit_params = dict( python_interpreter_path=sys.executable, + gallery_repo=GALLERY_REPO, ) systemd.install_unit(gallery_builder_service, builder_unit_template.format(**unit_params)) diff --git a/tljh-voila-gallery/tljh_voila_gallery/systemd-units/tljh-voila-gallery-builder.service b/tljh-voila-gallery/tljh_voila_gallery/systemd-units/tljh-voila-gallery-builder.service index 3117fe3..e9af183 100644 --- a/tljh-voila-gallery/tljh_voila_gallery/systemd-units/tljh-voila-gallery-builder.service +++ b/tljh-voila-gallery/tljh_voila_gallery/systemd-units/tljh-voila-gallery-builder.service @@ -11,6 +11,9 @@ PrivateTmp=yes PrivateDevices=yes ProtectKernelTunables=yes ProtectKernelModules=yes +# Update with the new gallery +ExecStartPre={python_interpreter_path} -m pip install -U {gallery_repo} +# Build the new Docker images ExecStart={python_interpreter_path} -m tljh_voila_gallery.build_images [Install]