A general-purpose build pack that automatically detects your application type, generates optimized Dockerfiles, and builds production-ready container images.
| Framework | Output Types |
|---|---|
| Next.js | Server (SSR) / Static |
| Nuxt | Server (SSR) / Static |
| Remix / React Router | Server (SSR) / Static |
| Astro | Server (SSR) / Static |
| SvelteKit | Server (SSR) / Static |
| Solid Start | Server (SSR) / Static |
| TanStack Start | Server (SSR) / Static |
| Vite | Static |
| Gatsby | Static |
| Angular | Server (SSR) / Static |
| Express | Server |
| Fastify | Server |
| NestJS | Server |
| AdonisJS | Server |
curl -fsSL https://raw.githubusercontent.com/coollabsio/coolpack/main/install.sh | bash
git clone https://github.com/coollabsio/coolpack.git
cd coolpack
./build.sh
The binary will be created at ./coolpack.
# Navigate to your project
cd my-app
# See what Coolpack detects
coolpack plan
# Generate Dockerfile
coolpack prepare
# Build container image
coolpack build
# Run the container (development only)
coolpack run
coolpack plan [path]Analyze and display the build plan without generating any files.
coolpack plan # Current directory
coolpack plan ./my-app # Specific path
coolpack plan --json # Output as JSON
coolpack plan --out # Save to coolpack.json
coolpack plan --out custom.json # Save to custom file
coolpack plan --packages curl --packages wget # Add custom packages
Flags:
| Flag | Description |
|------|-------------|
| --json | Output as JSON |
| -o, --out | Write plan to file (default: coolpack.json) |
| --packages | Additional APT packages to install |
coolpack prepare [path]Generate a Dockerfile in the .coolpack/ directory.
If a coolpack.json file exists in the project root, it will be used instead of running detection.
coolpack prepare
coolpack prepare --static-server nginx # Use nginx instead of Caddy
coolpack prepare --build-cmd "npm run build:prod"
coolpack prepare --plan coolpack.json # Use specific plan file
coolpack prepare --packages curl # Add custom APT packages
Flags:
| Flag | Description |
|------|-------------|
| -i, --install-cmd | Override install command |
| -b, --build-cmd | Override build command |
| -s, --start-cmd | Override start command |
| --static-server | Static server: caddy (default), nginx |
| --output-dir | Override static output directory (e.g., dist, build) |
| --spa | Enable SPA mode (serves index.html for all routes) |
| --no-spa | Disable SPA mode (overrides auto-detection) |
| --build-env | Build-time env vars (KEY=value or KEY) |
| --packages | Additional APT packages to install |
| --plan | Use plan file instead of detection |
coolpack build [path]Generate Dockerfile and build the container image.
If a coolpack.json file exists in the project root, it will be used instead of running detection.
coolpack build
coolpack build -n my-app -t v1.0.0
coolpack build --build-env NEXT_PUBLIC_API_URL=https://api.example.com
coolpack build --no-cache
coolpack build --plan coolpack.json # Use specific plan file
coolpack build --packages ffmpeg # Add custom APT packages
Flags:
| Flag | Description |
|------|-------------|
| -n, --name | Image name (defaults to directory name) |
| -t, --tag | Image tag (default: latest) |
| --no-cache | Build without Docker cache |
| -i, --install-cmd | Override install command |
| -b, --build-cmd | Override build command |
| -s, --start-cmd | Override start command |
| --static-server | Static server: caddy (default), nginx |
| --output-dir | Override static output directory (e.g., dist, build) |
| --spa | Enable SPA mode (serves index.html for all routes) |
| --no-spa | Disable SPA mode (overrides auto-detection) |
| --build-env | Build-time env vars |
| --packages | Additional APT packages to install |
| --plan | Use plan file instead of detection |
coolpack run [path]Build and run the container locally. For development only.
coolpack run
coolpack run -e DATABASE_URL=postgres://localhost/db
Flags:
| Flag | Description |
|------|-------------|
| -n, --name | Image name |
| -t, --tag | Image tag |
| -e, --env | Runtime env vars (KEY=value) |
coolpack versionPrint version information.
coolpack version
Override Coolpack behavior with environment variables:
| Variable | Description | Default |
|---|---|---|
COOLPACK_INSTALL_CMD |
Override install command | Auto-detected |
COOLPACK_BUILD_CMD |
Override build command | Auto-detected |
COOLPACK_START_CMD |
Override start command | Auto-detected |
COOLPACK_BASE_IMAGE |
Override base Docker image | Provider-specific |
COOLPACK_NODE_VERSION |
Override Node.js version | Auto-detected or 24 |
COOLPACK_STATIC_SERVER |
Static file server | caddy |
COOLPACK_SPA_OUTPUT_DIR |
Override static output directory | Framework-specific |
COOLPACK_SPA |
Enable SPA mode | Auto-detected |
COOLPACK_NO_SPA |
Disable SPA mode | false |
COOLPACK_PACKAGES |
Additional APT packages (comma-separated) | - |
NODE_VERSION |
Alternative to COOLPACK_NODE_VERSION (legacy) |
- |
Priority: CLI flags > Environment variables > Auto-detected
Default Base Images by Provider:
| Provider | Default Base Image |
|----------|-------------------|
| Node.js | node:<version>-slim |
| Node.js (bun) | oven/bun:<version>-slim |
Build-time variables are baked into the image during build:
coolpack build --build-env NEXT_PUBLIC_API_URL=https://api.example.com
Use for:
- Next.js NEXT_PUBLIC_* variables
- Vite VITE_* variables
- Any process.env accessed during build
Runtime variables are passed when running the container:
docker run -e DATABASE_URL=postgres://... -e API_KEY=... my-app:latest
Use for: - Secrets that shouldn't be in the image - Config that changes per environment
Add custom cache directories in package.json:
{
"cacheDirectories": [
".cache",
"tmp/build-cache"
]
}
Coolpack detects Node.js version from (in priority order):
COOLPACK_NODE_VERSION env varengines.node in package.json.nvmrc file.node-version file.tool-versions file (asdf)mise.toml file24Detected from (in priority order):
packageManager field in package.jsonpnpm-lock.yaml, bun.lockb, yarn.lock, package-lock.json)engines field in package.jsonnpmcd my-nextjs-app
coolpack build -n my-app -t latest
docker run -p 3000:3000 my-app:latest
cd my-vite-app
coolpack build
docker run -p 80:80 my-vite-app:latest
coolpack build \
--install-cmd "pnpm install --frozen-lockfile" \
--build-cmd "pnpm build:production" \
--start-cmd "node dist/server.js"
coolpack build \
--build-env NEXT_PUBLIC_API_URL=https://api.example.com \
--build-env NEXT_PUBLIC_GA_ID=UA-123456
coolpack build --static-server nginx
For Single Page Applications, Coolpack auto-detects client-side routers (vue-router, react-router-dom, etc.) and configures the server to serve index.html for all routes:
# Auto-detected when vue-router, react-router-dom, etc. is found
coolpack build
# Manual override
coolpack build --spa
Save a build plan and reuse it for reproducible builds:
# Generate and save plan
coolpack plan --out
# Edit coolpack.json to customize settings...
# Build using the plan file (auto-detected)
coolpack build
# Or specify explicitly
coolpack build --plan coolpack.json
Add system packages that aren't auto-detected:
# Via CLI flag
coolpack build --packages ffmpeg --packages curl
# Via environment variable
COOLPACK_PACKAGES=ffmpeg,curl coolpack build
# Via plan file (add to metadata.custom_packages)
git clone https://github.com/coollabsio/coolpack.git
cd coolpack
go mod download
./build.sh
coolpack/
├── main.go # Entry point
├── build.sh # Build script
├── cmd/coolpack/
│ ├── root.go # Root CLI command
│ ├── plan.go # Plan subcommand
│ ├── prepare.go # Prepare subcommand
│ ├── build.go # Build subcommand
│ └── run.go # Run subcommand
└── pkg/
├── app/
│ ├── context.go # App context (path, env, file helpers)
│ └── plan.go # Plan struct
├── detector/
│ ├── detector.go # Main detector, registers providers
│ └── types.go # Provider interface
├── generator/
│ └── generator.go # Dockerfile generation
└── providers/node/
├── node.go # Node.js provider
├── package_json.go # package.json parsing
├── package_manager.go # Package manager detection
├── version.go # Node version detection
├── framework.go # Framework detection
├── config_parser.go # JS/TS config parsing
└── native_deps.go # Native dependency detection
pkg/providers/<name>/<name>.goProvider interface:type Provider interface {
Name() string
Detect(ctx *app.Context) (bool, error)
Plan(ctx *app.Context) (*app.Plan, error)
}
pkg/detector/detector.go:func (d *Detector) registerProviders() {
d.providers = append(d.providers, node.New())
d.providers = append(d.providers, yourprovider.New())
}
For Node.js frameworks, edit pkg/providers/node/framework.go:
DetectFramework()Test against example projects:
# Test detection
./coolpack plan /path/to/test-project
# Test Dockerfile generation
./coolpack prepare /path/to/test-project
cat /path/to/test-project/.coolpack/Dockerfile
# Test full build
./coolpack build /path/to/test-project
github.com/spf13/cobra - CLI frameworkgithub.com/smacker/go-tree-sitter - AST parsing for JS/TS config filesdocker build with BuildKit cache mountscooluser, UID 1001)MIT
Contributions are welcome! Please feel free to submit issues and pull requests.
$ claude mcp add coolpack \
-- python -m otcore.mcp_server <graph>