mirror of
https://github.com/deuill/coreos-home-server.git
synced 2024-09-21 21:50:46 +00:00
Alex Palaistras
d8a4b7874f
This commit adds an `ExecCondition` directive on the `container-build@` service, used as a pre-requisite for all other Podman-based services, skipping `podman build` invocations unless local `Containerfile` or any files in the `container` sub-directories have changed. Container builds are responsible for the majority of time taken during boot, even with cache in place; this will help alleviate pressure and hopefully speed up boot considerably.
16 lines
809 B
Desktop File
16 lines
809 B
Desktop File
[Unit]
|
|
Description=Container Build for %I
|
|
Wants=network-online.target container-environment@%i.service container-network@internal.service container-build@%i.path
|
|
After=network-online.target container-environment@%i.service container-network@internal.service
|
|
ConditionPathExists=%E/coreos-home-server/%i/Containerfile
|
|
|
|
[Service]
|
|
Type=oneshot
|
|
SyslogIdentifier=%N
|
|
Environment=PODMAN_BUILD_OPTIONS=
|
|
ExecCondition=/bin/sh -c 'test -z "$(podman image list --quiet --filter until!="$(find %E/coreos-home-server/%i/{Containerfile,container} -type f -printf "%%T@\n" | sort -n | tail -1)" --filter reference=localhost/%i)"; exit $?'
|
|
ExecStart=/bin/podman build $PODMAN_BUILD_OPTIONS --file %E/coreos-home-server/%i/Containerfile --tag localhost/%i:latest %E/coreos-home-server/%i
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|