From f0fec97c819a90cf8cf9b87ffd1d2e72f89b1118 Mon Sep 17 00:00:00 2001 From: oct2pus Date: Sat, 30 Mar 2024 03:19:56 -0500 Subject: [PATCH] jadebot as a service --- docker-files/jbmasto/Dockerfile | 2 +- service-files/jbmasto.service | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 service-files/jbmasto.service diff --git a/docker-files/jbmasto/Dockerfile b/docker-files/jbmasto/Dockerfile index 866509b..06ef5c4 100644 --- a/docker-files/jbmasto/Dockerfile +++ b/docker-files/jbmasto/Dockerfile @@ -2,7 +2,7 @@ FROM debian:stable-slim RUN apt-get update && apt-get install -y fish toot ADD ./jbmasto/* /root RUN mkdir -p /root/.config/toot -RUN --mount=type=secret,id=config cat /run/secrets/config > /root/.config/toot/config.json +RUN --mount=type=secret,id=config cp /run/secrets/config /root/.config/toot/config.json WORKDIR /root CMD ./markov.fish diff --git a/service-files/jbmasto.service b/service-files/jbmasto.service new file mode 100644 index 0000000..c4a3bc8 --- /dev/null +++ b/service-files/jbmasto.service @@ -0,0 +1,20 @@ +[Unit] +Description=jbmasto.service +Wants=network.target +After=network-online.target +RequiresMountsFor=/var/lib/containers/storage /var/run/containers/storage + +# %E is "the XDG_CONFIG path" + +[Service] +Environment=PODMAN_SYSTEMD_UNIT=%n +Restart=on-failure +TimeoutStopSec=70 +ExecStart=/usr/bin/podman run -d --name=jbmasto localhost/jbmasto +ExecStop=/usr/bin/podman stop jbmasto +ExecStopPost=/usr/bin/podman rm jbmasto +Type=oneshot +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target default.target