Skip to content

Add Docker Compose and CI static publish as alternatives to install.sh - #29

Merged
paladini merged 4 commits into
masterfrom
cursor/docker-compose-pages-action-0441
Nov 16, 2026
Merged

paladini merged 4 commits into
masterfrom
cursor/docker-compose-pages-action-0441

Conversation

@paladini

@paladini paladini commented Nov 16, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Run official Ghost 6 with Docker Compose, content under ~/.ghost, without replacing the Ghost-CLI install.sh path.
  • Add a GitHub Actions workflow that builds the static site for GitHub Pages.
  • Keep deploy.sh / gssg on the host; Compose is an alternative for Windows/WSL.

Test plan

  • scripts/compose-smoke.sh against a local Compose stack
  • Confirm the Pages workflow publishes the same tree deploy.sh would
  • Ghost 6 image tag in Compose matches what production should run

Closes #28

Let Windows/WSL users run official Ghost 6 in Compose with content in
~/.ghost, keep deploy.sh/gssg on the host, and generate GitHub Pages
from Actions without changing the Ghost-CLI install path.

Co-authored-by: Fernando Paladini <fnpaladini@gmail.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Approval is blocked by a critical CI supply-chain risk involving mutable upstream code with publishing credentials, along with two moderate issues causing misleading uninstall status and stale helper logic on reruns.

3 open issues
What changed in this PR

This pull request adds Docker Compose as an optional Ghost runtime and introduces a reusable GitHub Actions workflow for generating and publishing static sites to GitHub Pages while preserving the existing install.sh and deploy.sh paths.

Changes:

  • Added Compose configuration, setup, export, smoke-test, and Docker-aware helper scripts.
  • Added reusable Pages publishing workflow, example configuration, and CI validation.
  • Updated documentation, contribution guidance, changelog, and repository housekeeping.
File Description
tests/​run-compose-tests.sh Adds checks for Compose configuration and workflow fixtures.
scripts/​export-static.sh Exports and validates static files without pushing them.
scripts/​compose-smoke.sh Validates and optionally starts the Docker Compose stack.
scripts/​compose-setup.sh Prepares the Docker-based Ghost installation layout under ~/.ghost.
readme.md Links users to the Docker and CI documentation.
install.sh Installs the static export helper for Ghost-CLI users.
includes/​uninstall.sh Adds Docker Compose-aware uninstall handling.
includes/​lib/​common.sh Adds configurable paths, Docker detection, and runtime readiness helpers.
examples/​github/​publish-static.yml Provides an example caller for the reusable publishing workflow.
docs/​v3/​REQUIREMENTS.md Documents Docker Compose as an alternative requirement.
docs/​v3/​GETTING-STARTED.md Adds the Docker setup path to the getting-started guidance.
docs/​v3/​DOCKER.md Documents Compose setup, configuration, publishing, and persistence.
docs/​v3/​DEPLOY.md Documents Docker and CI publishing alternatives.
docs/​v3/​CI.md Documents the reusable static publishing workflow.
docs/​TROUBLESHOOTING.md Adds Docker Compose troubleshooting guidance.
docs/​README.md Links to the new Docker and CI documentation.
docs/​GLOSSARY.md Defines Docker Compose and GitHub Actions terminology.
CONTRIBUTING.md Adds Compose checks and new project areas to contributor guidance.
compose.yaml Defines the official Ghost 6 Compose service and persistent content mount.
CHANGELOG.md Records the new Docker and CI publishing features.
.gitignore Ignores local Compose content and scratch files.
.github/​workflows/​publish-static.yml Implements reusable static export and GitHub Pages deployment.
.github/​workflows/​ci.yml Runs Compose fixture, workflow lint, and smoke checks.
.env.example Documents Compose environment variables.

Review effort: Lite

Comment thread .github/workflows/ci.yml Outdated

- name: Lint GitHub Actions workflows
run: |
bash <(curl --fail --silent --show-error --location https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
Comment thread includes/uninstall.sh
Comment on lines +21 to +25
if [ -f "${GHOST_INSTALL}/.docker" ]; then
if command -v docker >/dev/null 2>&1 && [ -f "${GHOST_INSTALL}/compose.yaml" ]; then
(cd "$GHOST_INSTALL" && docker compose down) || true
fi
echo "[INFO] Docker Compose Ghost was stopped. Your files are still in ${GHOST_INSTALL}."
Comment thread scripts/compose-setup.sh Outdated

cp "${ROOT}/includes/deploy.sh" "${GHOST_INSTALL}/"
cp "${ROOT}/includes/uninstall.sh" "${GHOST_INSTALL}/"
cp -R "${ROOT}/includes/lib" "${GHOST_INSTALL}/lib"
@paladini

Copy link
Copy Markdown
Owner Author

Review

The direction matches issue #28: Compose stays an alternative to install.sh, static generation stays on gssg, and CI can publish Pages. I would not merge this revision. Local boot of ghost:6 (6.77.0) returns HTTP 200, but the blog database is not on the content mount, so the persistence acceptance criterion is not met. Please treat the items below as changes requested.

Blocking

  1. SQLite is not stored in ~/.ghost/content. compose.yaml sets NODE_ENV=development and mounts /var/lib/ghost/content, but it does not set a SQLite path. I started ghost:6 with this file. Ghost logged Ghost database ready and GET / returned 200, then the only database file inside the container was /var/lib/ghost/versions/6.77.0/content/data/ghost-dev.db. The bind mount's data/ directory stayed empty, and docker compose down removed that container file. Official image docs require database__connection__filename inside the mounted content directory for a development volume (Ghost image README). Ghost's own dev compose also sets database__client: sqlite3 (compose.dev.sqlite.yaml). Please set both, point the filename at /var/lib/ghost/content/data/ghost.db, and extend the smoke check so it fails unless that file exists on the host mount after boot.

  2. Compose project name depends on the directory. Docs and compose-setup.sh tell people to run docker compose up either from this repo or from ~/.ghost. Compose names the project from the working directory, so those are different stacks (CI created ghost-on-github-pages-ghost-1). ensure_ghost_running and uninstall.sh always run Compose from ~/.ghost, so they can miss a container that was started from the repo and still hold port 2373. Set a fixed top-level name: in compose.yaml and use that everywhere.

  3. compose-setup.sh nests lib/ on the second run. Reproduced: the first run creates ~/.ghost/lib/common.sh; the second creates ~/.ghost/lib/lib/common.sh and leaves the original lib/common.sh in place. deploy.sh and export-static.sh keep sourcing the stale file. install.sh has the same cp -R .../lib pattern in move_includes, which this PR already edits. Copy the directory contents (cp -R source/. dest/) or replace the destination first, in both scripts.

  4. uninstall.sh reports success when Compose did not stop. docker compose down || true still prints that Ghost was stopped when Docker is missing, the compose file is missing, or down fails. A container can keep running. Print the stopped message only after down succeeds; otherwise warn that the stack may still be running and return a non-zero status.

  5. A blog workflow can publish an empty site. If content/ is absent, publish-static.yml warns and continues, and examples/github/publish-static.yml deploys on every push with deploy_pages: true. That can replace a real Pages site with a fresh Ghost. Fail the job when the content directory is missing unless the caller sets an explicit input such as allow_empty: true. Keep the dry-run on this tool repository explicit.

  6. CI installs actionlint from an unpinned main branch script. .github/workflows/ci.yml runs bash <(curl .../actionlint/main/scripts/download-actionlint.bash). That script can change without review. This job does not grant pages: write (those permissions are only on publish-static.yml), but it still executes upstream shell with the CI token. Pin the installer to a commit and the actionlint release to a version, or call a pinned action.

  7. Pages concurrency can cancel a production deploy. publish-static.yml sets cancel-in-progress: true. The current GitHub Pages starter sets cancel-in-progress: false so an in-progress deployment is allowed to finish (starter workflow).

Non-blocking

  • Add actions/configure-pages@v5 and consider actions/deploy-pages@v5 so the caller matches the current Pages starter. upload-pages-artifact@v3 already matches that starter.
  • Ghost logged ECONNREFUSED 127.0.0.1:2373 while sizing /favicon.ico. Inside the container, port 2373 is the host mapping, not the process port (2368). I did not run gssg, so image export is still unverified. Please run one local export and confirm images survive scripts/validate-static.sh.
  • The image log also says the jobs outbox needs MySQL and falls back to direct dispatch. That is acceptable for the documented SQLite/local mode; it is worth one sentence in docs/v3/DOCKER.md.
  • Fixture tests grep the YAML. They passed here, and so did shellcheck 0.10.0. They do not catch the database path, the second-run lib/ copy, or uninstall status.

Checks

  • bash tests/run-validation-tests.sh: passed.
  • bash tests/run-compose-tests.sh: passed (docker compose config skipped inside WSL because that client had no daemon).
  • shellcheck 0.10.0 with the repo's -x -e SC1091 arguments: passed.
  • Docker Desktop 4.87.0 / ghost:6 (6.77.0): compose.yaml booted and http://localhost:2373 returned 200. The SQLite file was not on the content mount. Stack removed afterward.
  • GitHub Actions on 43a9718: validate and compose-smoke succeeded. The smoke job only proves an HTTP response, which matches what I saw locally, and does not prove persistence.

Issue #28 is the right tracker for this work. It is not in the PR's closing-issue references. I did not edit the PR body. Adding Closes #28 is appropriate once this implementation meets the acceptance criteria, because merging should then close that issue.

SQLite now lives on the content mount, Compose uses one project name, and the Pages workflow stops when the blog content directory is missing.
gssg 1.1.4 needs --url, and wget's HTTP error status was aborting the crawl before localhost links were replaced.

@paladini paladini left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up

The blockers in the earlier review are fixed on 5ecdeb6. This is not an approval.

  • SQLite now stays on the content mount (database__client=sqlite3 and database__connection__filename=/var/lib/ghost/content/data/ghost.db). CI smoke checks that the host ghost.db exists.
  • gssg 1.1.4 is called with --url. --productionDomain is ignored by that release, and wget exit 8 was aborting the crawl before localhost links were rewritten.
  • An empty Pages publish is refused unless allow_empty is set. uninstall.sh no longer reports success when docker compose down fails. Re-running setup no longer nests lib/lib.

Local checks: Ghost admin, a published post that survived a container restart, static export with validation, shellcheck, and the repo test scripts. CI validate and compose-smoke passed on 5ecdeb6. deploy.sh git push and actions/deploy-pages were not run against a live Pages site. Merging this repository does not publish a blog.

Issue #28 matches the change and is still open. It is not formally linked on this PR.

The changelog and the version printed by install.sh need to match the release tag.
@paladini
paladini merged commit 64c0a5e into master Nov 16, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Docker Compose + GitHub Action para publicar o site estático (alternativa ao install.sh)

3 participants