49 lines
2.3 KiB
Text
49 lines
2.3 KiB
Text
|
#jinja2: lstrip_blocks: "True"
|
||
|
[Unit]
|
||
|
Description=Forgejo Runner ({{ forgejo_runner_identifier }})
|
||
|
{% for service in forgejo_runner_systemd_required_services_list %}
|
||
|
Requires={{ service }}
|
||
|
After={{ service }}
|
||
|
{% endfor %}
|
||
|
DefaultDependencies=no
|
||
|
|
||
|
[Service]
|
||
|
Type=simple
|
||
|
Environment="HOME={{ devture_systemd_docker_base_systemd_unit_home_path }}"
|
||
|
ExecStartPre=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} kill {{ forgejo_runner_identifier }} 2>/dev/null || true'
|
||
|
ExecStartPre=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm {{ forgejo_runner_identifier }} 2>/dev/null || true'
|
||
|
|
||
|
ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} create \
|
||
|
--rm \
|
||
|
--name={{ forgejo_runner_identifier }} \
|
||
|
--user={{ forgejo_runner_uid }}:{{ forgejo_runner_gid }} \
|
||
|
--log-driver=none \
|
||
|
--cap-drop=ALL \
|
||
|
--network={{ forgejo_runner_container_network }} \
|
||
|
--env-file={{ forgejo_runner_base_path }}/env \
|
||
|
--mount type=bind,src={{ forgejo_runner_config_path }},dst=/data \
|
||
|
--tmpfs=/tmp:rw,noexec,nosuid,size=1024m \
|
||
|
{% for volume in forgejo_runner_container_additional_volumes %}
|
||
|
--mount type={{ volume.type | default('bind' if '/' in volume.src else 'volume') }},src={{ volume.src }},dst={{ volume.dst }}{{ (',' + volume.options) if volume.options | default('') else '' }} \
|
||
|
{% endfor %}
|
||
|
{% for arg in forgejo_runner_container_extra_arguments %}
|
||
|
{{ arg }} \
|
||
|
{% endfor %}
|
||
|
{{ forgejo_runner_container_image }}
|
||
|
|
||
|
{% for network in forgejo_runner_container_additional_networks %}
|
||
|
ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} network connect {{ network }} {{ forgejo_runner_identifier }}
|
||
|
{% endfor %}
|
||
|
|
||
|
ExecStart={{ devture_systemd_docker_base_host_command_docker }} start --attach {{ forgejo_runner_identifier }}
|
||
|
|
||
|
ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} kill {{ forgejo_runner_identifier }} 2>/dev/null || true'
|
||
|
ExecStop=-{{ devture_systemd_docker_base_host_command_sh }} -c '{{ devture_systemd_docker_base_host_command_docker }} rm {{ forgejo_runner_identifier }} 2>/dev/null || true'
|
||
|
|
||
|
Restart=always
|
||
|
RestartSec=30
|
||
|
SyslogIdentifier={{ forgejo_runner_identifier }}
|
||
|
|
||
|
[Install]
|
||
|
WantedBy=multi-user.target
|