4 changed files with 49 additions and 5 deletions
@ -0,0 +1,43 @@ |
|||||
|
[Unit] |
||||
|
Description=Update Nginx root directory from a Git repository |
||||
|
Documentation=https://hub.docker.com/r/alpine/git |
||||
|
After=network-online.target |
||||
|
Before=nginx-server.service |
||||
|
|
||||
|
# Only start if the service has been configured |
||||
|
ConditionPathExists=/etc/quadlets/nginx/config.env |
||||
|
# And if the git repo has already been cloned |
||||
|
ConditionPathExists=/var/lib/quadlets/nginx/.git |
||||
|
|
||||
|
# Start/stop this unit when the target is started/stopped |
||||
|
PartOf=nginx.target |
||||
|
|
||||
|
[Container] |
||||
|
ContainerName=nginx-update-job |
||||
|
Image=docker.io/alpine/git:latest |
||||
|
|
||||
|
# Network configuration |
||||
|
Network=host |
||||
|
|
||||
|
# Those environment variables will be injected by podman into the container |
||||
|
EnvironmentFile=/etc/quadlets/nginx/config.env |
||||
|
|
||||
|
# Clone the website repository |
||||
|
Exec=pull |
||||
|
WorkingDir=/var/git |
||||
|
|
||||
|
# Volume mounts |
||||
|
Volume=/var/lib/quadlets/nginx:/var/git:z |
||||
|
|
||||
|
[Service] |
||||
|
Restart=no |
||||
|
TimeoutStartSec=30 |
||||
|
|
||||
|
# These environment variables are sourced to be used by systemd in the Exec* commands |
||||
|
EnvironmentFile=/etc/quadlets/nginx/config.env |
||||
|
|
||||
|
# This container is a job - run once to completion |
||||
|
Type=oneshot |
||||
|
|
||||
|
[Install] |
||||
|
WantedBy=nginx.target |
||||
Loading…
Reference in new issue