Browse Source

Add docker-cli installation to Dockerfile and streamline WOL script

main
Bastian (BaM) 3 months ago
parent
commit
8ecf2a2639
  1. 2
      Dockerfile
  2. 8
      scripts/auto-boot-ollama-host.sh

2
Dockerfile

@ -4,7 +4,7 @@ FROM alpine:3.20
# Install minimal tooling
RUN apk add --no-cache \
--repository=https://dl-cdn.alpinelinux.org/alpine/edge/testing wol \
&& apk add --no-cache bash curl ca-certificates
&& apk add --no-cache bash curl ca-certificates docker-cli
# Copy script
WORKDIR /app

8
scripts/auto-boot-ollama-host.sh

@ -27,28 +27,22 @@ send_wol() {
wol -i "$WOL_BCAST" -p "$WOL_PORT" "$WOL_MAC" || true
}
# Basic pre-flight: show which container is watched
log "Watching logs for container='${CONTAINER_NAME}' since='${SINCE}'"
log "Looking for pattern: ${ERROR_PATTERN}"
echo "Exited. Sleeping..."
sleep infinity
# Stream logs and parse
"${DOCKER_CLI}" logs -f --since "${SINCE}" "${CONTAINER_NAME}" 2>&1 | \
while IFS= read -r line; do
# echo "$line" # uncomment for debugging
if echo "$line" | grep -qE "${ERROR_PATTERN}"; then
log "Detected EHOSTUNREACH for Ollama (${OLLAMA_HOST}:${OLLAMA_PORT})."
echo ok
# ... in your remediation block:
if [[ -n "$WOL_MAC" ]]; then
log "Sending WOL to $WOL_MAC via ${WOL_BCAST}:${WOL_PORT}"
#send_wol
send_wol
fi
echo ok
# --- remediation examples (optional) ---
# if [[ -n "$WOL_MAC" ]]; then
# log "Sending WOL to ${WOL_MAC}"

Loading…
Cancel
Save