summaryrefslogtreecommitdiff
path: root/rpi.sh
diff options
context:
space:
mode:
authorJoe Carstairs <me@joeac.net>2025-12-13 21:56:00 +0000
committerJoe Carstairs <me@joeac.net>2025-12-13 21:56:00 +0000
commit1b1d0eddf8dbc83937480cfdf9efbe652754e71d (patch)
tree6203244c6b6d6e83ea350eac60cf098d695de21b /rpi.sh
parent7300b1542147d1834f8ccb48474cd66d027c68ee (diff)
rpi.sh
Diffstat (limited to 'rpi.sh')
-rwxr-xr-xrpi.sh21
1 files changed, 13 insertions, 8 deletions
diff --git a/rpi.sh b/rpi.sh
index df6f5f3..5bf5d94 100755
--- a/rpi.sh
+++ b/rpi.sh
@@ -1,14 +1,19 @@
-#!/bin/sh
+#!/bin/bash
DOCKER_BIN=podman
-WEBSITE_DIR="$HOME/joeac.net"
+CONTAINER=joeac.net
PORT=80
-set -eux
+set -eu
-$DOCKER_BIN stop --all
-cd "$WEBSITE_DIR"
-git pull
-$DOCKER_BIN build -t joeac.net .
-$DOCKER_BIN run -dt -p $PORT:4321 joeac.net
+running_containers=`$DOCKER_BIN ps | tail -n +2`
+IFS=$'\n'
+for line in $running_containers; do
+ if [[ "$line" =~ ^[a-z0-9]+[[:space:]]+localhost/$CONTAINER:[0-9a-z]+[[:space:]] ]]; then
+ $DOCKER_BIN stop $(echo "$line" | cut -d' ' -f 1)
+ fi
+done
+
+set -x
+$DOCKER_BIN run -dt -p $PORT:4321 $CONTAINER