diff options
| author | Joe Carstairs <me@joeac.net> | 2025-12-13 21:56:00 +0000 |
|---|---|---|
| committer | Joe Carstairs <me@joeac.net> | 2025-12-13 21:56:00 +0000 |
| commit | 1b1d0eddf8dbc83937480cfdf9efbe652754e71d (patch) | |
| tree | 6203244c6b6d6e83ea350eac60cf098d695de21b | |
| parent | 7300b1542147d1834f8ccb48474cd66d027c68ee (diff) | |
rpi.sh
| -rwxr-xr-x | rpi.sh | 21 |
1 files changed, 13 insertions, 8 deletions
@@ -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 |
