-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Deployment
AstroPaper builds to a fully static site (HTML, CSS, JS, and assets). You can host it anywhere that serves static files.
-
Set
site.urlinastro-paper.config.tsto your deployed URL (e.g."https://myblog.com/"). This is used for canonical URLs, the sitemap, the RSS feed, and OG image URLs. -
Run
pnpm buildlocally to verify the build succeeds. -
Run
pnpm previewto smoke-test the production build before deploying.
Vercel is the recommended deployment platform and is used for the official demo.
Via Vercel dashboard:
- Import your repository on vercel.com
- Vercel auto-detects Astro and sets the build command to
astro build -
Override the build command to
pnpm buildso Pagefind indexing runs after the Astro build - Deploy
Via Vercel CLI:
npm i -g vercel
vercelvercel.json (optional override):
{
"buildCommand": "pnpm build",
"outputDirectory": "dist"
}- Import your repository on netlify.com
- Set the build command to
pnpm build - Set the publish directory to
dist - Deploy
netlify.toml (recommended):
[build]
command = "pnpm build"
publish = "dist"GitHub Pages requires setting a base path if the site is served from a subdirectory (e.g. https://username.github.io/repo-name/).
1. Update astro.config.ts:
export default defineConfig({
site: "https://username.github.io",
base: "/repo-name",
// ...
});2. Add a GitHub Actions workflow (.github/workflows/deploy.yml):
name: Deploy to GitHub Pages
on:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v3
- uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm
- run: pnpm install
- run: pnpm build
- uses: actions/upload-pages-artifact@v3
with:
path: dist
deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/deploy-pages@v4
id: deployment3. In your repository settings, go to Pages → Source → select GitHub Actions.
The
basepath setting also affects all internal links. AstroPaper'swithBaseutility handles this automatically.
- Create a new Pages project and connect your repository
- Set the build command to
pnpm build - Set the build output directory to
dist - Deploy
AstroPaper includes a Dockerfile for containerized deployment. It uses a two-stage build:
-
Build stage — installs dependencies and runs
pnpm build -
Runtime stage — serves the static files with
nginx
# Base stage
FROM node:lts AS base
WORKDIR /app
RUN corepack enable && corepack prepare pnpm@latest --activate
COPY package.json pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile
COPY . .
RUN pnpm run build
# Runtime stage
FROM nginx:mainline-alpine-slim AS runtime
COPY --from=base /app/dist /usr/share/nginx/html
EXPOSE 80Build and run:
docker build -t astro-paper .
docker run -p 8080:80 astro-paperThe site will be available at http://localhost:8080.
With Docker Compose (compose.yaml is included):
docker compose upGetting Started
Writing Content
Features & Reference
Deployment
Links