From 01bcbb06070cdbca194b8d6806b5f548ad619da9 Mon Sep 17 00:00:00 2001
From: Dennis Eriksen <dennis@terje.dnns.no>
Date: Sat, 9 Feb 2019 17:35:01 +0100
Subject: adding systemd-service-file

---
 README.md       |  2 ++
 davical.service | 21 +++++++++++++++++++++
 2 files changed, 23 insertions(+)
 create mode 100644 davical.service

diff --git a/README.md b/README.md
index 0bb763f..810fd7a 100644
--- a/README.md
+++ b/README.md
@@ -2,6 +2,8 @@
 
 Initial README
 
+## systemd
+There is a systemd-service file if you want to use it. I find it helpful.
 
 ## Upgrading
 When you need to upgrade the database, remember to run the
diff --git a/davical.service b/davical.service
new file mode 100644
index 0000000..b78ccaf
--- /dev/null
+++ b/davical.service
@@ -0,0 +1,21 @@
+[Unit]
+Description=DAViCal Docker container
+Requires=network.target docker.service watchtower.service
+After=watchtower.service
+
+[Service]
+# Don't restart - it will conflict with watchtower.
+Restart=no
+
+# Start with removing old images
+ExecStartPre=-/usr/bin/docker rm -f davical
+ExecStart=/usr/bin/docker run --rm \
+                              --name davical \
+                              --env-file /etc/systemd/system/davical.service.d/env \
+                              --publish 2203:80 \
+                              dennis/davical:v0.7
+
+ExecStop=/usr/bin/docker stop -t 2 davical
+
+[Install]
+WantedBy=default.target
-- 
cgit v1.2.3