Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,26 @@ 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=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 /docs/content
VOLUME /content

EXPOSE 3000

ENTRYPOINT ["chronicle"]
CMD ["serve", "--port", "3000"]
CMD ["serve", "--port", "3000", "--host", "0.0.0.0"]
3 changes: 3 additions & 0 deletions docs/cli.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ chronicle dev [options]
| `--content <path>` | Content directory | `content` |
| `--config <path>` | Path to `chronicle.yaml` | `./chronicle.yaml` |
| `-p, --port <port>` | Port number | `3000` |
| `--host <host>` | Host address | `localhost` |

## build

Expand Down Expand Up @@ -67,6 +68,7 @@ chronicle start [options]
|------|-------------|---------|
| `--content <path>` | Content directory | `content` |
| `-p, --port <port>` | Port number | `3000` |
| `--host <host>` | Host address | `localhost` |

## serve

Expand All @@ -81,6 +83,7 @@ chronicle serve [options]
| `--content <path>` | Content directory | `content` |
| `--config <path>` | Path to `chronicle.yaml` | `./chronicle.yaml` |
| `-p, --port <port>` | Port number | `3000` |
| `--host <host>` | Host address | `localhost` |
| `--preset <preset>` | Deploy preset (`vercel`, `cloudflare`, `node-server`) | — |

## Resolution Order
Expand Down
16 changes: 8 additions & 8 deletions docs/docker.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -47,7 +47,7 @@ services:
ports:
- "3000:3000"
volumes:
- ./content:/docs/content
- ./content:/content
```

## Available Commands
Expand All @@ -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
```
3 changes: 2 additions & 1 deletion packages/chronicle/src/cli/commands/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export const devCommand = new Command('dev')
.option('-p, --port <port>', 'Port number', '3000')
.option('--content <path>', 'Content directory')
.option('--config <path>', 'Path to chronicle.yaml')
.option('--host <host>', 'Host address', 'localhost')
.action(async options => {
const { contentDir, configPath } = await loadCLIConfig(options.config, { content: options.content });
const port = parseInt(options.port, 10);
Expand All @@ -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();
Expand Down
3 changes: 2 additions & 1 deletion packages/chronicle/src/cli/commands/serve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export const serveCommand = new Command('serve')
.option('-p, --port <port>', 'Port number', '3000')
.option('--content <path>', 'Content directory')
.option('--config <path>', 'Path to chronicle.yaml')
.option('--host <host>', 'Host address', 'localhost')
.option(
'--preset <preset>',
'Deploy preset (vercel, cloudflare, node-server)'
Expand Down Expand Up @@ -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();
Expand Down
3 changes: 2 additions & 1 deletion packages/chronicle/src/cli/commands/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export const startCommand = new Command('start')
.description('Start production server')
.option('-p, --port <port>', 'Port number', '3000')
.option('--content <path>', 'Content directory')
.option('--host <host>', 'Host address', 'localhost')
.action(async options => {
const { contentDir, configPath } = await loadCLIConfig(undefined, { content: options.content });
const port = parseInt(options.port, 10);
Expand All @@ -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();
Expand Down