28 lines
726 B
Bash
Executable file
28 lines
726 B
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
# In this solution, 0 is used instead of N
|
|
|
|
# Check if required directory exists
|
|
if [ ! -d ~/nginx0 ]
|
|
then
|
|
echo "~/nginx0 missing!"
|
|
exit 1
|
|
fi
|
|
|
|
# Create container
|
|
podman create \
|
|
--name nginx0 \
|
|
--network traefik \
|
|
-v ~/nginx0/website:/volumes/website:Z,ro \
|
|
-v ~/nginx0/conf:/etc/nginx/conf.d:Z,ro \
|
|
--tz local \
|
|
--label "io.containers.autoupdate=registry" \
|
|
docker.io/library/nginx:alpine
|
|
|
|
# Change current directory to not have to move the systemd service file afterwards
|
|
cd ~/.config/systemd/user
|
|
# Generate the systemd service file
|
|
podman generate systemd --new --files --name nginx0
|
|
|
|
# Enable and start the container
|
|
systemctl --user enable --now container-nginx0
|