deploy
Deploy your EreoJS application to production with a single command. Supports multiple platforms with automatic configuration generation.
Usage
bun ereo deploy [target] [options]Or via package.json:
{
"scripts": {
"deploy": "ereo deploy",
"deploy:prod": "ereo deploy --prod"
}
}Deployment Targets
| Target | Description | URL Pattern |
|---|---|---|
vercel | Vercel (default) | *.vercel.app |
cloudflare | Cloudflare Pages/Workers | *.workers.dev |
fly | Fly.io | *.fly.dev |
netlify | Netlify | *.netlify.app |
docker | Docker image build | Local image |
Options
| Option | Alias | Description | Default |
|---|---|---|---|
--prod | --production | Deploy to production | false |
--dry-run | --dryRun | Preview deployment without executing | false |
--name | Project name for new deployments | Auto-detected | |
--no-build | Skip the build step | false | |
--help | -h | Show deploy help |
Examples
Quick Deploy
# Auto-detect platform and deploy
bun ereo deploy
# Deploy to production
bun ereo deploy --prodPlatform-Specific
# Vercel
bun ereo deploy vercel --prod
# Cloudflare Workers
bun ereo deploy cloudflare
# Fly.io
bun ereo deploy fly --prod
# Netlify
bun ereo deploy netlify --prod
# Docker
bun ereo deploy docker --name my-appPreview Deployment
# See what would be deployed without executing
bun ereo deploy --dry-runSkip Build
# Deploy existing build
bun ereo deploy --no-buildPlatform Configuration
Vercel
The deploy command auto-generates vercel.json if not present:
{
"buildCommand": "bun run build",
"outputDirectory": "dist",
"framework": null,
"functions": {
"api/**/*.ts": {
"runtime": "@vercel/bun@0.1.0"
}
}
}Prerequisites:
- Vercel CLI (
bunx vercelorbun add -g vercel) - Vercel account and authentication
Deploy:
# Preview deployment
bun ereo deploy vercel
# Production deployment
bun ereo deploy vercel --prodManual Vercel setup:
# Install CLI
bun add -g vercel
# Login
vercel login
# Link project
vercel linkCloudflare Workers
Auto-generates wrangler.toml if not present:
name = "ereo-app"
main = "dist/server/index.js"
compatibility_date = "2024-01-01"
[site]
bucket = "./dist/client"
[build]
command = "bun run build"Prerequisites:
- Wrangler CLI (
bun add -g wrangler) - Cloudflare account and authentication
Deploy:
bun ereo deploy cloudflareManual Wrangler setup:
# Install CLI
bun add -g wrangler
# Login
wrangler login
# Deploy
wrangler deployFly.io
Auto-generates fly.toml if not present:
app = "ereo-app"
primary_region = "iad"
[build]
builder = "oven/bun"
[http_service]
internal_port = 3000
force_https = true
auto_stop_machines = true
auto_start_machines = true
min_machines_running = 0Prerequisites:
- Fly CLI (
flyctl) - Fly.io account and authentication
Install Fly CLI:
# macOS
brew install flyctl
# Linux
curl -L https://fly.io/install.sh | sh
# Windows
powershell -Command "iwr https://fly.io/install.ps1 -useb | iex"Deploy:
# Login
fly auth login
# Create app (first time)
fly apps create my-app
# Deploy
bun ereo deploy fly --prodNetlify
Auto-generates netlify.toml if not present:
[build]
command = "bun run build"
publish = "dist/client"
functions = "dist/server"
[functions]
node_bundler = "esbuild"
[[redirects]]
from = "/api/*"
to = "/.netlify/functions/api/:splat"
status = 200
[[redirects]]
from = "/*"
to = "/index.html"
status = 200Prerequisites:
- Netlify CLI (
bun add -g netlify-cli) - Netlify account and authentication
Deploy:
# Install CLI
bun add -g netlify-cli
# Login
netlify login
# Deploy preview
bun ereo deploy netlify
# Deploy production
bun ereo deploy netlify --prodDocker
Auto-generates Dockerfile if not present:
# Build stage
FROM oven/bun:1 as builder
WORKDIR /app
COPY package.json bun.lockb* ./
RUN bun install --frozen-lockfile
COPY . .
RUN bun run build
# Production stage
FROM oven/bun:1-slim
WORKDIR /app
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/package.json ./
COPY --from=builder /app/node_modules ./node_modules
ENV NODE_ENV=production
EXPOSE 3000
CMD ["bun", "run", "start"]Build and run:
# Build image
bun ereo deploy docker --name my-app
# Run container
docker run -p 3000:3000 my-app:latest
# With environment variables
docker run -p 3000:3000 -e DATABASE_URL=... my-app:latestPush to registry:
# Tag for registry
docker tag my-app:latest registry.example.com/my-app:latest
# Push
docker push registry.example.com/my-app:latestAuto-Detection
The deploy command automatically detects the target platform by checking for existing configuration files:
vercel.json- Vercelwrangler.toml- Cloudflarefly.toml- Fly.ionetlify.toml- NetlifyDockerfile- Docker
If no configuration file is found, defaults to Vercel.
Environment Variables
Platform-Specific Environment Variables
Vercel:
vercel env add DATABASE_URL productionCloudflare:
wrangler secret put DATABASE_URLFly.io:
fly secrets set DATABASE_URL=...Netlify:
netlify env:set DATABASE_URL ...Docker:
docker run -e DATABASE_URL=... my-app:latestBuild-Time Variables
For variables needed at build time:
# Vercel
vercel env add EREO_PUBLIC_API_URL production
# Or in vercel.json
{
"build": {
"env": {
"EREO_PUBLIC_API_URL": "https://api.example.com"
}
}
}Programmatic Usage
import { deploy } from '@ereo/cli';
const result = await deploy({
target: 'vercel',
production: true,
build: true,
name: 'my-app',
});
if (result.success) {
console.log('Deployed to:', result.url);
} else {
console.error('Deploy failed:', result.error);
}Deploy Result
interface DeployResult {
success: boolean;
url?: string; // Deployment URL
deploymentId?: string; // Platform-specific ID
logs?: string[]; // Deployment logs
error?: string; // Error message if failed
}CI/CD Integration
GitHub Actions
name: Deploy
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v1
- name: Install dependencies
run: bun install
- name: Deploy to Vercel
run: bun ereo deploy vercel --prod
env:
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}GitLab CI
deploy:
stage: deploy
image: oven/bun:1
script:
- bun install
- bun ereo deploy vercel --prod
only:
- main
variables:
VERCEL_TOKEN: $VERCEL_TOKENTroubleshooting
CLI Not Found
# Install platform CLI
bun add -g vercel # Vercel
bun add -g wrangler # Cloudflare
bun add -g netlify-cli # Netlify
# Fly.io requires separate installation
curl -L https://fly.io/install.sh | shAuthentication Failed
# Re-authenticate
vercel login
wrangler login
fly auth login
netlify loginBuild Fails
# Run build locally first
bun ereo build
# Check for errors
DEBUG=ereo:* bun ereo buildDeployment Timeout
For large applications:
# Increase timeout (platform-specific)
vercel --timeout 600
# Or use --no-build and deploy pre-built
bun ereo build
bun ereo deploy --no-buildDocker Build Fails
# Check Docker is running
docker info
# Build with verbose output
docker build -t my-app . --progress=plain
# Clean and rebuild
docker system prune -f
bun ereo deploy dockerBest Practices
1. Use Environment Variables
Never commit secrets. Use platform-specific secret management:
# Set secrets per platform
vercel env add API_KEY production
fly secrets set API_KEY=...2. Preview Before Production
Always test preview deployments first:
bun ereo deploy vercel # Preview
bun ereo deploy vercel --prod # Production (after testing)3. Use Dry Run
Check deployment configuration:
bun ereo deploy --dry-run4. Version Your Config
Commit platform configuration files:
git add vercel.json fly.toml wrangler.toml netlify.toml
git commit -m "Add deployment configuration"5. Set Up CI/CD
Automate deployments on merge to main branch.
Related
- build - Production build
- start - Production server
- dev - Development server
- Environment Variables