From 609a0d3997ab8ccca0061c426c9592b0445f6ec3 Mon Sep 17 00:00:00 2001 From: Paul Walko Date: Sat, 2 Dec 2023 09:40:33 -0500 Subject: [PATCH] wind docker --- wind/docker/.gitignore | 2 ++ wind/docker/Dockerfile.caddy | 9 +++++++++ wind/docker/caddy.sh | 34 ++++++++++++++++++++++++++++++++ wind/docker/plex.sh | 38 ++++++++++++++++++++++++++++++++++++ wind/docker/watchtower.sh | 23 ++++++++++++++++++++++ 5 files changed, 106 insertions(+) create mode 100644 wind/docker/.gitignore create mode 100644 wind/docker/Dockerfile.caddy create mode 100755 wind/docker/caddy.sh create mode 100755 wind/docker/plex.sh create mode 100755 wind/docker/watchtower.sh diff --git a/wind/docker/.gitignore b/wind/docker/.gitignore new file mode 100644 index 0000000..296e7ff --- /dev/null +++ b/wind/docker/.gitignore @@ -0,0 +1,2 @@ +CaverEveryHour/ +*.env diff --git a/wind/docker/Dockerfile.caddy b/wind/docker/Dockerfile.caddy new file mode 100644 index 0000000..0019ae3 --- /dev/null +++ b/wind/docker/Dockerfile.caddy @@ -0,0 +1,9 @@ +FROM caddy:2.7.4-builder AS builder + +RUN xcaddy build \ + --with github.com/caddy-dns/porkbun \ + --with github.com/caddyserver/replace-response + +FROM caddy:2.7.4 + +COPY --from=builder /usr/bin/caddy /usr/bin/caddy diff --git a/wind/docker/caddy.sh b/wind/docker/caddy.sh new file mode 100755 index 0000000..e5b9943 --- /dev/null +++ b/wind/docker/caddy.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +set -e + +up () { + docker network create pew-net || true + + # main caddy container + docker build -t customcaddy:latest -f Dockerfile.caddy . + + docker run \ + --detach \ + --name caddy \ + --restart unless-stopped \ + --label com.centurylinklabs.watchtower.enable=false \ + --privileged \ + --volume $HOME/scripts-private/wind/Caddyfile:/etc/caddy/Caddyfile:ro \ + --volume /bigdata/caddy/data:/data:rw \ + --publish 443:443 \ + --publish 443:443/udp \ + --network pew-net \ + customcaddy:latest +} + +down () { + docker stop caddy || true + docker rm caddy || true +} + +logs () { + docker logs --follow caddy +} + +$@ diff --git a/wind/docker/plex.sh b/wind/docker/plex.sh new file mode 100755 index 0000000..8bd408a --- /dev/null +++ b/wind/docker/plex.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +set -e + +up () { + docker network create pew-net || true + + # Exposed on port 32400 in pew-net + docker run \ + --detach \ + --name plex \ + --restart unless-stopped \ + --env PUID=1000 \ + --env PGID=1000 \ + --env PLEX_CLAIM=claim-rQJqKnhLEPWJS8hH16jU \ + --env VERSION=docker \ + --device /dev/dri:/dev/dri:rw \ + --volume /bigdata/plex/config:/config:rw \ + --volume /bigdata/media/homemedia:/media/homemedia:ro \ + --volume /bigdata/media/audiobooks:/media/audiobooks:ro \ + --volume /bigdata/media/movies:/media/movies:ro \ + --volume /bigdata/media/music:/media/music:ro \ + --volume /bigdata/media/radio:/media/radio:ro \ + --volume /bigdata/media/tv:/media/tv:ro \ + --network host \ + ghcr.io/linuxserver/plex:latest +} + +down () { + docker stop plex || true + docker rm plex || true +} + +logs () { + docker logs --follow plex +} + +$@ diff --git a/wind/docker/watchtower.sh b/wind/docker/watchtower.sh new file mode 100755 index 0000000..da118ca --- /dev/null +++ b/wind/docker/watchtower.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +set -e + +up () { + # Poll interval: 1800s (30 mins) + docker run \ + --detach \ + --name watchtower \ + --volume /var/run/docker.sock:/var/run/docker.sock:rw \ + ghcr.io/containrrr/watchtower:amd64-1.7.1 --interval 1800 +} + +down () { + docker stop watchtower || true + docker rm watchtower || true +} + +logs () { + docker logs --follow watchtower +} + +$@