📤 部署模式

模式说明适用场景
Static (SSG)纯静态站点博客、文档、营销页
Server (SSR)服务端渲染动态内容、用户系统
Hybrid混合模式部分静态、部分动态

▲ Vercel

bash
# 安装适配器
npx astro add vercel

# 部署
vercel

🌐 Netlify

bash
# 安装适配器
npx astro add netlify

# 部署
netlify deploy --prod

☁️ Cloudflare Pages

bash
# 安装适配器
npx astro add cloudflare

# 构建命令
npm run build

# 输出目录:dist

🖥️ 自托管

bash
# 安装 Node.js 适配器
npx astro add node

# 构建
npm run build

# 运行
node dist/server/entry.mjs

🐳 Docker

dockerfile
FROM node:18-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
EXPOSE 4321
CMD ["node", "dist/server/entry.mjs"]