Jenkins/resources/com/cadoles/podman/pod.service.gotmpl

24 lines
745 B
Go Template

[Unit]
Description={{ .Env.IMAGE_NAME }} pod service
Wants=network-online.target
After=network-online.target
RequiresMountsFor=/run/containers/storage
[Service]
Type=simple
Environment=PODMAN_SYSTEMD_UNIT=%n
EnvironmentFile=-/etc/cadoles-pod-{{ .Env.IMAGE_NAME }}.conf
Environment=IMAGE_NAME={{ .Env.IMAGE_NAME }} IMAGE_TAG={{ .Env.IMAGE_TAG }}
PassEnvironment=PODMAN_ARGS IMAGE_NAME IMAGE_TAG
Restart=on-failure
TimeoutStopSec=70
{{ if getenv "SYSTEMD_EXEC_STARTPRE" "" }}
ExecStartPre={{ .Env.SYSTEMD_EXEC_STARTPRE }}
{{ end }}
ExecStart=/bin/sh -c "podman run ${PODMAN_ARGS} '${IMAGE_NAME}:${IMAGE_TAG}'"
{{ if getenv "SYSTEMD_EXEC_STARTPOST" "" }}
ExecStartPost={{ .Env.SYSTEMD_EXEC_STARTPOST }}
{{ end }}
[Install]
WantedBy=default.target