Files
homarr/apps/workshop/preview-docs.sh
T
+12 fcd7c979df feat!: release v2 (#6545)
Co-authored-by: Artur <145776561+arturict@users.noreply.github.com>
Co-authored-by: arturict <arturict@users.noreply.github.com>
Co-authored-by: Thomas <thomas@ajnart.fr>
Co-authored-by: Afonso Jorge Ramos <afonsojorgeramos@gmail.com>
Co-authored-by: Danura30082 <danura30082+github@gmail.com>
Co-authored-by: Kushie <122986913+kushiemoon-dev@users.noreply.github.com>
Co-authored-by: ajnart <thomas@ajnart.fr>
Co-authored-by: ajnart <thomas@ajnart.dev>
Co-authored-by: chenjun <chenjun@foxmail.com>
Co-authored-by: Wikibear <wikibear@users.noreply.github.com>
Co-authored-by: Bergasha <bergasha@gmail.com>
Co-authored-by: leafyelin <43306196+leafyelin@users.noreply.github.com>
Co-authored-by: Lucas Araujo <lucas.lra@gmail.com>
Co-authored-by: GreenMonito <86085570+GreenMonito@users.noreply.github.com>
Co-authored-by: Nerdy-Technician <roffo@nerdy-technician.social>
Co-authored-by: Jun <34545896+jcstrong@users.noreply.github.com>
Co-authored-by: Edmond Abraham <54119952+gitedmond@users.noreply.github.com>
Co-authored-by: thrawnx <tight.bulb9384@fastmail.com>
Co-authored-by: Chris <58918656+nordada@users.noreply.github.com>
Co-authored-by: yi111 <153097222+Yi-111-a@users.noreply.github.com>
Co-authored-by: Yanis <naamaneyanis@gmail.com>
Co-authored-by: Wikibear <me@sej.de>
Co-authored-by: alessiottavo <93441886+alessiottavo@users.noreply.github.com>
2026-10-02 21:00:14 +02:00

49 lines
1.8 KiB
Bash

#!/bin/sh
set -eu
repo_dir=$(CDPATH= cd -- "$(dirname -- "$0")/../.." && pwd)
cd "$repo_dir"
preview_name=${DOCS_PREVIEW_NAME:-homarr-docs-static-preview}
preview_host=${DOCS_PREVIEW_HOST:-127.0.0.1}
preview_port=${DOCS_PREVIEW_PORT:-8093}
preview_image=homarr-workshop:docs-static-preview
preview_url="http://$preview_host:$preview_port"
api_url=${WORKSHOP_API_URL:-$preview_url}
api_url=${api_url%/}
api_url=${api_url%/api}
remote_api_url=${WORKSHOP_REMOTE_API_URL:-${WORKSHOP_API_URL:-}}
remote_api_url=${remote_api_url%/}
remote_api_url=${remote_api_url%/api}
if [ ! -f apps/docs/out/404.html ]; then
echo 'Build the docs first: pnpm --filter @homarr/docs build' >&2
exit 1
fi
docker build --target development -f apps/workshop/Dockerfile -t "$preview_image" .
docker run --detach --rm --name "$preview_name" \
--user "$(id -u):$(id -g)" \
--publish "$preview_host:$preview_port:8090" \
--mount "type=bind,src=$repo_dir/apps/docs/out,dst=/pb_public" \
--mount "type=bind,src=$repo_dir/apps/workshop/pb_hooks,dst=/pb_hooks,readonly" \
--mount "type=bind,src=$repo_dir/apps/workshop/pb_migrations,dst=/pb_migrations,readonly" \
--tmpfs "/pb_data:uid=$(id -u),gid=$(id -g)" \
--env "HOMARR_WEBSITE_URL=$preview_url" \
--env "WORKSHOP_API_URL=$api_url" \
--env "WORKSHOP_REMOTE_API_URL=$remote_api_url" \
--env "WORKSHOP_WEB_URL=$preview_url/workshop" \
"$preview_image"
attempt=0
until docker exec "$preview_name" wget -q --spider http://127.0.0.1:8090/api/health >/dev/null 2>&1; do
attempt=$((attempt + 1))
if [ "$attempt" -ge 30 ]; then
echo "Preview did not become healthy. Inspect it with: docker logs $preview_name" >&2
exit 1
fi
sleep 1
done
printf 'Static docs: %s/docs/\nWorkshop API: %s\nStop: docker stop %s\n' "$preview_url" "$api_url" "$preview_name"