Convert to systemd service
This commit is contained in:
parent
349775bffb
commit
58b11a152e
5 changed files with 28 additions and 14 deletions
4
build.sh
4
build.sh
|
|
@ -1,4 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Build/rebuild the image.
|
|
||||||
docker build --no-cache -t notes-server .
|
|
||||||
15
install.sh
Executable file
15
install.sh
Executable file
|
|
@ -0,0 +1,15 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Build the notes-server image.
|
||||||
|
docker build --no-cache -t notes-server .
|
||||||
|
|
||||||
|
# Run the notes-server image.
|
||||||
|
docker run -d \
|
||||||
|
--name notes-server \
|
||||||
|
-v "/var/www/html/notes/site:/usr/share/nginx/html" \
|
||||||
|
-p 42069:80 \
|
||||||
|
notes-server
|
||||||
|
|
||||||
|
# Install and enable the systemctl service.
|
||||||
|
cp notes.service /etc/systemd/system/notes.service
|
||||||
|
systemctl enable notes.service
|
||||||
13
notes.service
Normal file
13
notes.service
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Notes server
|
||||||
|
After=docker.service
|
||||||
|
Wants=network-online.target docker.socket
|
||||||
|
Requires=docker.socket
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
ExecStart=/usr/bin/docker start -a notes-server
|
||||||
|
ExecStop=/usr/bin/docker stop -t 10 notes-server
|
||||||
|
Restart=always
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Build/rebuild the image.
|
|
||||||
docker build --no-cache -t notes-server .
|
|
||||||
|
|
||||||
# Run the image, listening on port 8080.
|
|
||||||
docker run --mount type=bind,src=./site,dst=/usr/share/nginx/html -p 42069:80 -t notes-server
|
|
||||||
3
run.sh
3
run.sh
|
|
@ -1,3 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
docker run --mount type=bind,src=./site,dst=/usr/share/nginx/html -p 42069:80 -t notes-server
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue