Vibengine
Templates

Template Examples

Example templates for common use cases

Template Examples

This page provides complete, ready-to-use Dockerfile examples for common use cases. Each example includes the full Dockerfile and sample code showing how to use the template.

Python Data Science

A comprehensive data science environment with NumPy, Pandas, Matplotlib, and Jupyter:

FROM vibengine/base:latest

RUN apt-get update && apt-get install -y \
    python3 \
    python3-pip \
    python3-dev \
    libffi-dev \
    libfreetype6-dev \
    libpng-dev \
    && rm -rf /var/lib/apt/lists/*

RUN pip3 install --no-cache-dir \
    numpy==1.26.4 \
    pandas==2.2.0 \
    matplotlib==3.8.2 \
    scikit-learn==1.4.0 \
    scipy==1.12.0 \
    seaborn==0.13.1 \
    jupyter==1.0.0

WORKDIR /home/user
import { Sandbox } from "vibengine"

const sandbox = await Sandbox.create("python-data-science")

// Run a quick analysis
const result = await sandbox.commands.run(`python3 -c "
import pandas as pd
import numpy as np

data = pd.DataFrame({
    'values': np.random.randn(1000)
})
print(data.describe())
"`)
console.log(result.stdout)

await sandbox.close()
from vibengine import Sandbox

sandbox = Sandbox("python-data-science")

# Run a quick analysis
result = sandbox.commands.run("""python3 -c "
import pandas as pd
import numpy as np

data = pd.DataFrame({
    'values': np.random.randn(1000)
})
print(data.describe())
" """)
print(result.stdout)

sandbox.close()

Node.js Development

A Node.js 20 LTS environment with TypeScript and common development tools:

FROM vibengine/base:latest

# Install Node.js 20 LTS
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
    && apt-get install -y nodejs \
    && rm -rf /var/lib/apt/lists/*

# Install global tools
RUN npm install -g \
    typescript@5.3 \
    tsx \
    prettier \
    eslint \
    nodemon \
    pm2

# Verify installation
RUN node --version && npm --version && tsc --version

WORKDIR /home/user
import { Sandbox } from "vibengine"

const sandbox = await Sandbox.create("nodejs-dev")

// Compile and run TypeScript directly
await sandbox.files.write(
  "/home/user/hello.ts",
  'const msg: string = "Hello from TypeScript!"; console.log(msg);'
)
const result = await sandbox.commands.run("tsx /home/user/hello.ts")
console.log(result.stdout) // "Hello from TypeScript!"

await sandbox.close()
from vibengine import Sandbox

sandbox = Sandbox("nodejs-dev")

# Compile and run TypeScript directly
sandbox.files.write(
    "/home/user/hello.ts",
    'const msg: string = "Hello from TypeScript!"; console.log(msg);'
)
result = sandbox.commands.run("tsx /home/user/hello.ts")
print(result.stdout)  # "Hello from TypeScript!"

sandbox.close()

Go Development

A Go development environment with the Go toolchain and common tools:

FROM vibengine/base:latest

ENV GOLANG_VERSION=1.22.0

# Install Go
RUN curl -fsSL "https://go.dev/dl/go${GOLANG_VERSION}.linux-amd64.tar.gz" \
    | tar -C /usr/local -xzf -

ENV PATH="/usr/local/go/bin:/home/user/go/bin:${PATH}"
ENV GOPATH="/home/user/go"

# Install commonly used Go tools
RUN go install golang.org/x/tools/gopls@latest \
    && go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest \
    && go install github.com/air-verse/air@latest

WORKDIR /home/user
import { Sandbox } from "vibengine"

const sandbox = await Sandbox.create("go-dev")

// Create and run a Go program
await sandbox.files.write("/home/user/main.go", `package main

import "fmt"

func main() {
    fmt.Println("Hello from Go!")
}
`)

const result = await sandbox.commands.run("cd /home/user && go run main.go")
console.log(result.stdout) // "Hello from Go!"

await sandbox.close()
from vibengine import Sandbox

sandbox = Sandbox("go-dev")

# Create and run a Go program
sandbox.files.write("/home/user/main.go", """package main

import "fmt"

func main() {
    fmt.Println("Hello from Go!")
}
""")

result = sandbox.commands.run("cd /home/user && go run main.go")
print(result.stdout)  # "Hello from Go!"

sandbox.close()

Custom CLI Tools

A template with custom command-line tools and utilities pre-installed:

FROM vibengine/base:latest

RUN apt-get update && apt-get install -y \
    jq \
    yq \
    httpie \
    tree \
    ripgrep \
    fd-find \
    bat \
    ffmpeg \
    imagemagick \
    && rm -rf /var/lib/apt/lists/*

# Install additional tools from GitHub releases
RUN curl -fsSL https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 \
    -o /usr/local/bin/yq && chmod +x /usr/local/bin/yq

WORKDIR /home/user

Full-Stack Web Development

A template combining Node.js, Python, and common web development tools:

FROM vibengine/base:latest

# Install Node.js 20
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
    && apt-get install -y nodejs \
    && rm -rf /var/lib/apt/lists/*

# Install Python 3 and pip
RUN apt-get update && apt-get install -y \
    python3 \
    python3-pip \
    python3-venv \
    && rm -rf /var/lib/apt/lists/*

# Install global Node.js packages
RUN npm install -g \
    typescript \
    tsx \
    create-next-app \
    create-vite

# Install Python web tools
RUN pip3 install --no-cache-dir \
    fastapi \
    uvicorn \
    httpx \
    pydantic

WORKDIR /home/user

Full-stack templates are larger and take longer to build. Consider whether you actually need all tools in a single template, or if separate focused templates would be more efficient.

Using These Examples

To use any of these examples:

  1. Create a new template directory:

    mkdir my-template && cd my-template
    ve template init
  2. Replace the generated Dockerfile with the example content.

  3. Update the id in ve.toml to match your desired template name:

    id = "python-data-science"
    dockerfile = "Dockerfile"
  4. Build and push:

    ve template build
  5. Use in your code by referencing the template ID.

Next Steps

On this page