myvps-site/deploy.sh
opencode 84c582337a
Some checks failed
deploy-myvps-site / deploy (push) Failing after 0s
Add my-vps presentation site with public/restricted split
2026-11-22 23:19:25 +00:00

43 lines
1.7 KiB
Bash
Executable file

#!/bin/sh
set -eu
ROOT=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
CONTENT_DIR=${CONTENT_DIR:-$ROOT/../myvps-site-content}
IMAGE=myvps-site:latest
NAME=myvps-site
HOST=www.194.164.167.80.nip.io
cp "$CONTENT_DIR"/pages/*.md "$ROOT/src/content/pages/"
docker build -t "$IMAGE" "$ROOT"
if docker ps -a --format '{{.Names}}' | grep -qx "$NAME"; then
docker rm -f "$NAME" >/dev/null
fi
docker run -d \
--name "$NAME" \
--restart unless-stopped \
--network web \
-l "traefik.enable=true" \
-l "traefik.docker.network=web" \
-l "traefik.http.routers.mysite.rule=Host(\`$HOST\`)" \
-l "traefik.http.routers.mysite.entrypoints=web" \
-l "traefik.http.routers.mysite.middlewares=mysite-https-redirect@docker" \
-l "traefik.http.routers.mysite-tls.rule=Host(\`$HOST\`)" \
-l "traefik.http.routers.mysite-tls.entrypoints=websecure" \
-l "traefik.http.routers.mysite-tls.tls=true" \
-l "traefik.http.routers.mysite-tls.tls.certresolver=le" \
-l "traefik.http.routers.mysite-tls.service=mysite" \
-l "traefik.http.routers.mysite-riservata.rule=Host(\`$HOST\`) && PathPrefix(\`/riservata\`)" \
-l "traefik.http.routers.mysite-riservata.entrypoints=websecure" \
-l "traefik.http.routers.mysite-riservata.priority=100" \
-l "traefik.http.routers.mysite-riservata.tls=true" \
-l "traefik.http.routers.mysite-riservata.tls.certresolver=le" \
-l "traefik.http.routers.mysite-riservata.middlewares=authelia@docker" \
-l "traefik.http.routers.mysite-riservata.service=mysite" \
-l "traefik.http.middlewares.mysite-https-redirect.redirectscheme.scheme=https" \
-l "traefik.http.middlewares.mysite-https-redirect.redirectscheme.permanent=true" \
-l "traefik.http.services.mysite.loadbalancer.server.port=80" \
"$IMAGE"