diff --git a/apps/workshop/README.md b/apps/workshop/README.md index 1c608e75a..89ec747bd 100644 --- a/apps/workshop/README.md +++ b/apps/workshop/README.md @@ -34,6 +34,12 @@ Build the documentation and serve it from PocketBase using the same production i pnpm docker:docs ``` -Open `http://127.0.0.1:3003`. Set `DOCS_EXPOSE_PORT` to use another host port. The preview container is removed when it stops and does not persist PocketBase data. +Open `http://127.0.0.1:3003`. Set `DOCS_EXPOSE_PORT` to use another host port. The preview does not mount or persist PocketBase data. + +This command starts the profiled `docs` service from `apps/workshop/docker-compose.yml`. It does not start the development `workshop` service. Stop and remove the preview with: + +```sh +docker compose -f apps/workshop/docker-compose.yml --profile docs rm --stop --force docs +``` Production data lives in `/pb_data`. The image serves the built Homarr documentation and Workshop UI from `/pb_public`. diff --git a/apps/workshop/docker-compose.yml b/apps/workshop/docker-compose.yml index 7f87df4a0..51a69745b 100644 --- a/apps/workshop/docker-compose.yml +++ b/apps/workshop/docker-compose.yml @@ -19,3 +19,19 @@ services: - ./pb_migrations:/pb_migrations:ro security_opt: - no-new-privileges:true + + docs: + profiles: + - docs + build: + context: ../.. + dockerfile: apps/workshop/Dockerfile + target: production + args: + POCKETBASE_VERSION: 0.39.6 + environment: + PB_ALLOWED_ORIGINS: ${PB_ALLOWED_ORIGINS:-*} + ports: + - "127.0.0.1:${DOCS_EXPOSE_PORT:-3003}:8090" + security_opt: + - no-new-privileges:true diff --git a/apps/workshop/run-docs.sh b/apps/workshop/run-docs.sh deleted file mode 100755 index 26550bdfe..000000000 --- a/apps/workshop/run-docs.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh -set -eu - -DOCS_IMAGE=${DOCS_IMAGE:-homarr/docs:local} -DOCS_EXPOSE_PORT=${DOCS_EXPOSE_PORT:-3003} - -docker build \ - --target production \ - --file apps/workshop/Dockerfile \ - --tag "$DOCS_IMAGE" \ - . - -exec docker run \ - --rm \ - --name homarr-docs \ - --publish "127.0.0.1:${DOCS_EXPOSE_PORT}:8090" \ - --env PB_ALLOWED_ORIGINS='*' \ - "$DOCS_IMAGE" diff --git a/package.json b/package.json index 97a5ce52b..84f992e50 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "db:studio": "pnpm -F db studio", "dev": "pnpm -F nextjs dev", "dev:docs": "pnpm -F @homarr/docs dev", - "docker:docs": "sh apps/workshop/run-docs.sh", + "docker:docs": "docker compose -f apps/workshop/docker-compose.yml up --build docs", "docker:dev": "docker compose -f ./development/development.docker-compose.yml up", "format": "turbo format --continue -- --check", "format:fix": "turbo format --continue",