From 38f49dd3b4644b7ebff83273bab4e6ac0d5d9a3e Mon Sep 17 00:00:00 2001 From: Paul Walko Date: Sun, 29 Oct 2023 18:41:45 -0400 Subject: [PATCH] add links --- links/docker/Dockerfile.caddy | 9 +++++++++ links/docker/caddy.sh | 32 ++++++++++++++++++++++++++++++++ links/docker/jenkins.sh | 25 +++++++++++++++++++++++++ links/docker/watchtower.sh | 23 +++++++++++++++++++++++ 4 files changed, 89 insertions(+) create mode 100644 links/docker/Dockerfile.caddy create mode 100755 links/docker/caddy.sh create mode 100755 links/docker/jenkins.sh create mode 100755 links/docker/watchtower.sh diff --git a/links/docker/Dockerfile.caddy b/links/docker/Dockerfile.caddy new file mode 100644 index 0000000..0019ae3 --- /dev/null +++ b/links/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/links/docker/caddy.sh b/links/docker/caddy.sh new file mode 100755 index 0000000..8a90ff5 --- /dev/null +++ b/links/docker/caddy.sh @@ -0,0 +1,32 @@ +#!/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 \ + --privileged \ + --volume $HOME/scripts-private/links/Caddyfile:/etc/caddy/Caddyfile:ro \ + --volume /subway/caddy/data:/data:rw \ + --publish $(tailscale ip -4):443:443 \ + --network pew-net \ + customcaddy:latest +} + +down () { + docker stop caddy || true + docker rm caddy || true +} + +logs () { + docker logs --follow caddy +} + +$@ diff --git a/links/docker/jenkins.sh b/links/docker/jenkins.sh new file mode 100755 index 0000000..320f8ae --- /dev/null +++ b/links/docker/jenkins.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +set -e + +up () { + # Exposted on 8080 in pew-net + docker run \ + --detach \ + --name jenkins \ + --restart unless-stopped \ + --volume /subway/jenkins/jenkins_home:/var/jenkins_home:rw \ + --network pew-net \ + jenkins/jenkins:lts +} + +down () { + docker stop jenkins || true + docker rm jenkins || true +} + +logs () { + docker logs --follow jenkins +} + +$@ diff --git a/links/docker/watchtower.sh b/links/docker/watchtower.sh new file mode 100755 index 0000000..2c1810d --- /dev/null +++ b/links/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.4.0 --interval 1800 +} + +down () { + docker stop watchtower || true + docker rm watchtower || true +} + +logs () { + docker logs --follow watchtower +} + +$@