This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
# Minimal Development Dockerfile for Ghost Core
|
||||
# Source code is mounted at runtime for hot-reload support
|
||||
|
||||
ARG NODE_VERSION=22.18.0
|
||||
|
||||
FROM node:$NODE_VERSION-bullseye-slim
|
||||
|
||||
# Install system dependencies needed for building native modules
|
||||
RUN apt-get update && \
|
||||
apt-get install -y \
|
||||
build-essential \
|
||||
curl \
|
||||
python3 \
|
||||
git && \
|
||||
rm -rf /var/lib/apt/lists/* && \
|
||||
apt clean
|
||||
|
||||
WORKDIR /home/ghost
|
||||
|
||||
# Copy package files for dependency installation
|
||||
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml .npmrc ./
|
||||
COPY ghost/core/package.json ghost/core/package.json
|
||||
COPY ghost/i18n/package.json ghost/i18n/package.json
|
||||
COPY ghost/parse-email-address/package.json ghost/parse-email-address/package.json
|
||||
|
||||
# Install dependencies
|
||||
# Note: Dependencies are installed at build time, but source code is mounted at runtime.
|
||||
|
||||
# Copy root lifecycle scripts/hooks needed by `pnpm install`
|
||||
COPY .github/scripts .github/scripts
|
||||
COPY .github/hooks .github/hooks
|
||||
|
||||
# Enable corepack so it can read packageManager from package.json and provide pnpm
|
||||
RUN corepack enable
|
||||
|
||||
# Install deps with a persistent pnpm store cache to speed up rebuilds
|
||||
RUN --mount=type=cache,target=/root/.local/share/pnpm/store,id=pnpm-store \
|
||||
pnpm install --frozen-lockfile --prefer-offline
|
||||
|
||||
# Copy entrypoint script that optionally loads Tinybird config
|
||||
COPY docker/ghost-dev/entrypoint.sh entrypoint.sh
|
||||
RUN chmod +x entrypoint.sh
|
||||
|
||||
# Public app assets are served via /ghost/assets/* in dev mode.
|
||||
# Caddy forwards these paths to host frontend dev servers.
|
||||
ENV portal__url=/ghost/assets/portal/portal.min.js \
|
||||
comments__url=/ghost/assets/comments-ui/comments-ui.min.js \
|
||||
sodoSearch__url=/ghost/assets/sodo-search/sodo-search.min.js \
|
||||
sodoSearch__styles=/ghost/assets/sodo-search/main.css \
|
||||
signupForm__url=/ghost/assets/signup-form/signup-form.min.js \
|
||||
announcementBar__url=/ghost/assets/announcement-bar/announcement-bar.min.js
|
||||
|
||||
# Source code will be mounted from host at /home/ghost/ghost/core
|
||||
# This allows the Ghost dev script to pick up file changes for hot-reload
|
||||
WORKDIR /home/ghost/ghost/core
|
||||
|
||||
ENTRYPOINT ["/home/ghost/entrypoint.sh"]
|
||||
CMD ["pnpm", "dev"]
|
||||
@@ -0,0 +1,35 @@
|
||||
# Ghost Core Dev Docker Image
|
||||
|
||||
Minimal Docker image for running Ghost Core in development with hot-reload support.
|
||||
|
||||
## Purpose
|
||||
|
||||
This lightweight image:
|
||||
- Installs only Ghost Core dependencies
|
||||
- Mounts source code from the host at runtime
|
||||
- Enables `nodemon` for automatic restarts on file changes
|
||||
- Works with the Caddy gateway to proxy frontend assets from host dev servers
|
||||
|
||||
## Key Differences from Main Dockerfile
|
||||
|
||||
**Main `Dockerfile`** (for E2E tests, full builds):
|
||||
- Builds all frontend apps (Admin, Portal, AdminX apps, etc.)
|
||||
- Bundles everything into the image
|
||||
- ~15 build stages, 5-10 minute build time
|
||||
|
||||
**This `Dockerfile`** (for local development):
|
||||
- Only installs dependencies
|
||||
- No frontend builds or bundling
|
||||
- Source code mounted at runtime
|
||||
- Used for: Local development with `pnpm dev`
|
||||
|
||||
## Usage
|
||||
|
||||
This image is used automatically when running:
|
||||
|
||||
```bash
|
||||
pnpm dev # Starts Docker backend + frontend dev servers on host
|
||||
pnpm dev:analytics # Include Tinybird analytics
|
||||
pnpm dev:storage # Include MinIO S3-compatible object storage
|
||||
pnpm dev:all # Include all optional services
|
||||
```
|
||||
Executable
+34
@@ -0,0 +1,34 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# Configure Ghost to use Tinybird Local
|
||||
# Sources tokens from /mnt/shared-config/.env.tinybird created by tb-cli
|
||||
if [ -f /mnt/shared-config/.env.tinybird ]; then
|
||||
source /mnt/shared-config/.env.tinybird
|
||||
if [ -n "${TINYBIRD_WORKSPACE_ID:-}" ] && [ -n "${TINYBIRD_ADMIN_TOKEN:-}" ]; then
|
||||
export tinybird__workspaceId="$TINYBIRD_WORKSPACE_ID"
|
||||
export tinybird__adminToken="$TINYBIRD_ADMIN_TOKEN"
|
||||
echo "Tinybird configuration loaded successfully"
|
||||
else
|
||||
echo "WARNING: Tinybird not enabled: Missing required environment variables in .env.tinybird" >&2
|
||||
fi
|
||||
else
|
||||
echo "WARNING: Tinybird not enabled: .env.tinybird file not found at /mnt/shared-config/.env.tinybird" >&2
|
||||
fi
|
||||
|
||||
|
||||
# Configure Stripe webhook secret
|
||||
if [ -f /mnt/shared-config/.env.stripe ]; then
|
||||
source /mnt/shared-config/.env.stripe
|
||||
if [ -n "${STRIPE_WEBHOOK_SECRET:-}" ]; then
|
||||
export WEBHOOK_SECRET="$STRIPE_WEBHOOK_SECRET"
|
||||
echo "Stripe webhook secret configured successfully"
|
||||
else
|
||||
echo "WARNING: Stripe webhook secret not found in shared config"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Execute the CMD
|
||||
exec "$@"
|
||||
|
||||
Reference in New Issue
Block a user