From 363315ad0a48d7d5d7ccff5cc73dfcf6c494f20c Mon Sep 17 00:00:00 2001 From: Rishabh Date: Wed, 8 Apr 2026 12:50:34 +0530 Subject: [PATCH 1/4] feat: add --host flag to dev, start, and serve commands Allows binding to a custom host address (defaults to localhost). Use --host 0.0.0.0 for Docker container port mapping. Co-Authored-By: Claude Opus 4.6 (1M context) --- packages/chronicle/src/cli/commands/dev.ts | 3 ++- packages/chronicle/src/cli/commands/serve.ts | 3 ++- packages/chronicle/src/cli/commands/start.ts | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/chronicle/src/cli/commands/dev.ts b/packages/chronicle/src/cli/commands/dev.ts index 3d73b6d..b34853c 100644 --- a/packages/chronicle/src/cli/commands/dev.ts +++ b/packages/chronicle/src/cli/commands/dev.ts @@ -9,6 +9,7 @@ export const devCommand = new Command('dev') .option('-p, --port ', 'Port number', '3000') .option('--content ', 'Content directory') .option('--config ', 'Path to chronicle.yaml') + .option('--host ', 'Host address', 'localhost') .action(async options => { const { contentDir, configPath } = await loadCLIConfig(options.config, { content: options.content }); const port = parseInt(options.port, 10); @@ -23,7 +24,7 @@ export const devCommand = new Command('dev') const config = await createViteConfig({ packageRoot: PACKAGE_ROOT, projectRoot: process.cwd(), contentDir, configPath }); const server = await createServer({ ...config, - server: { ...config.server, port } + server: { ...config.server, port, host: options.host } }); await server.listen(); diff --git a/packages/chronicle/src/cli/commands/serve.ts b/packages/chronicle/src/cli/commands/serve.ts index 0af33a2..14062c7 100644 --- a/packages/chronicle/src/cli/commands/serve.ts +++ b/packages/chronicle/src/cli/commands/serve.ts @@ -9,6 +9,7 @@ export const serveCommand = new Command('serve') .option('-p, --port ', 'Port number', '3000') .option('--content ', 'Content directory') .option('--config ', 'Path to chronicle.yaml') + .option('--host ', 'Host address', 'localhost') .option( '--preset ', 'Deploy preset (vercel, cloudflare, node-server)' @@ -38,7 +39,7 @@ export const serveCommand = new Command('serve') console.log(chalk.cyan('Starting production server...')); const server = await preview({ ...config, - preview: { port } + preview: { port, host: options.host } }); server.printUrls(); diff --git a/packages/chronicle/src/cli/commands/start.ts b/packages/chronicle/src/cli/commands/start.ts index 8603942..2626b30 100644 --- a/packages/chronicle/src/cli/commands/start.ts +++ b/packages/chronicle/src/cli/commands/start.ts @@ -8,6 +8,7 @@ export const startCommand = new Command('start') .description('Start production server') .option('-p, --port ', 'Port number', '3000') .option('--content ', 'Content directory') + .option('--host ', 'Host address', 'localhost') .action(async options => { const { contentDir, configPath } = await loadCLIConfig(undefined, { content: options.content }); const port = parseInt(options.port, 10); @@ -21,7 +22,7 @@ export const startCommand = new Command('start') const config = await createViteConfig({ packageRoot: PACKAGE_ROOT, projectRoot: process.cwd(), contentDir, configPath }); const server = await preview({ ...config, - preview: { port } + preview: { port, host: options.host } }); server.printUrls(); From 8726b3f27f15d4312c162ee284135ec8303d3296 Mon Sep 17 00:00:00 2001 From: Rishabh Date: Wed, 8 Apr 2026 14:31:22 +0530 Subject: [PATCH 2/4] feat: add --host flag to CLI and fix Docker setup Add --host flag (default: localhost) to dev, start, and serve commands for Docker container port mapping. Fix Dockerfile by copying node_modules to runner stage and using /content as working directory. Co-Authored-By: Claude Opus 4.6 (1M context) --- Dockerfile | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 701b8a1..c5abcf2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,21 +17,22 @@ RUN chmod +x bin/chronicle.js RUN ln -s /app/packages/chronicle/bin/chronicle.js /usr/local/bin/chronicle # --- init project --- -WORKDIR /docs +WORKDIR /content RUN bun add /app/packages/chronicle RUN chronicle init # --- runner --- FROM base AS runner -WORKDIR /docs +WORKDIR /content -COPY --from=builder /docs /docs +COPY --from=builder /content /content COPY --from=builder /app/packages/chronicle /app/packages/chronicle +COPY --from=builder /app/node_modules /app/node_modules RUN ln -s /app/packages/chronicle/bin/chronicle.js /usr/local/bin/chronicle -VOLUME /docs/content +VOLUME /content EXPOSE 3000 ENTRYPOINT ["chronicle"] -CMD ["serve", "--port", "3000"] +CMD ["serve", "--port", "3000", "--host", "0.0.0.0"] From 6ae052aec03a14148c1921f5e052edf4263daae2 Mon Sep 17 00:00:00 2001 From: Rishabh Date: Wed, 8 Apr 2026 14:37:20 +0530 Subject: [PATCH 3/4] docs: add --host flag to CLI docs and fix Docker mount paths Update cli.mdx with --host flag for dev, start, and serve commands. Update docker.mdx to use /content mount path matching Dockerfile changes. Co-Authored-By: Claude Opus 4.6 (1M context) --- docs/cli.mdx | 3 +++ docs/docker.mdx | 16 ++++++++-------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/docs/cli.mdx b/docs/cli.mdx index 0cd7330..3d615a2 100644 --- a/docs/cli.mdx +++ b/docs/cli.mdx @@ -40,6 +40,7 @@ chronicle dev [options] | `--content ` | Content directory | `content` | | `--config ` | Path to `chronicle.yaml` | `./chronicle.yaml` | | `-p, --port ` | Port number | `3000` | +| `--host ` | Host address | `localhost` | ## build @@ -67,6 +68,7 @@ chronicle start [options] |------|-------------|---------| | `--content ` | Content directory | `content` | | `-p, --port ` | Port number | `3000` | +| `--host ` | Host address | `localhost` | ## serve @@ -81,6 +83,7 @@ chronicle serve [options] | `--content ` | Content directory | `content` | | `--config ` | Path to `chronicle.yaml` | `./chronicle.yaml` | | `-p, --port ` | Port number | `3000` | +| `--host ` | Host address | `localhost` | | `--preset ` | Deploy preset (`vercel`, `cloudflare`, `node-server`) | — | ## Resolution Order diff --git a/docs/docker.mdx b/docs/docker.mdx index 4e0a252..75eaf10 100644 --- a/docs/docker.mdx +++ b/docs/docker.mdx @@ -19,23 +19,23 @@ docker pull raystack/chronicle The default command builds and starts a production server on port 3000. ```bash -docker run -p 3000:3000 -v ./content:/docs/content raystack/chronicle +docker run -p 3000:3000 -v ./content:/content raystack/chronicle ``` -Mount your content directory (containing MDX files) to `/docs/content`. Place `chronicle.yaml` in the content directory or it will use defaults. +Mount your content directory (containing MDX files) to `/content`. Place `chronicle.yaml` in the content directory or it will use defaults. ## Development Server Override the default command with `dev` for hot reload: ```bash -docker run -p 3000:3000 -v ./content:/docs/content raystack/chronicle dev --port 3000 +docker run -p 3000:3000 -v ./content:/content raystack/chronicle dev --port 3000 ``` ## Custom Port ```bash -docker run -p 8080:8080 -v ./content:/docs/content raystack/chronicle serve --port 8080 +docker run -p 8080:8080 -v ./content:/content raystack/chronicle serve --port 8080 ``` ## Docker Compose @@ -47,7 +47,7 @@ services: ports: - "3000:3000" volumes: - - ./content:/docs/content + - ./content:/content ``` ## Available Commands @@ -56,11 +56,11 @@ The entrypoint is `chronicle`, so any CLI command can be passed: ```bash # Build only -docker run -v ./content:/docs/content raystack/chronicle build +docker run -v ./content:/content raystack/chronicle build # Start pre-built server -docker run -p 3000:3000 -v ./content:/docs/content raystack/chronicle start --port 3000 +docker run -p 3000:3000 -v ./content:/content raystack/chronicle start --port 3000 # Build and start (default) -docker run -p 3000:3000 -v ./content:/docs/content raystack/chronicle serve --port 3000 +docker run -p 3000:3000 -v ./content:/content raystack/chronicle serve --port 3000 ``` From 77a1a53b73947957f5caf1fccf89b4707bc701ec Mon Sep 17 00:00:00 2001 From: Rishabh Date: Wed, 8 Apr 2026 14:48:53 +0530 Subject: [PATCH 4/4] refactor: use production install in Docker runner stage Replace copying full node_modules with bun install --production in the runner stage for a smaller image with only runtime dependencies. Co-Authored-By: Claude Opus 4.6 (1M context) --- Dockerfile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index c5abcf2..14f3c0e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,7 +27,11 @@ WORKDIR /content COPY --from=builder /content /content COPY --from=builder /app/packages/chronicle /app/packages/chronicle -COPY --from=builder /app/node_modules /app/node_modules +COPY --from=deps /app/package.json /app/bun.lock /app/ +COPY --from=deps /app/packages/chronicle/package.json /app/packages/chronicle/ +WORKDIR /app +RUN bun install --production --frozen-lockfile +WORKDIR /content RUN ln -s /app/packages/chronicle/bin/chronicle.js /usr/local/bin/chronicle VOLUME /content