Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
name: Publish Templates

on:
push:
branches: [master]
paths:
- '**/e2b.Dockerfile'
- '**/e2b.toml'
- '**/compile_page.sh'
- 'scripts/**'
- '.github/workflows/publish.yml'
- '.github/workflows/build.yml'
workflow_run:
workflows: ["Build Templates"]
types:
- completed
branches:
- master

concurrency:
group: publish-templates-${{ github.ref }}
cancel-in-progress: true

jobs:
publish:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
permissions:
contents: read
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
## Code0 Sandbox Templates

[![Publish Templates](https://github.com/Code0App/templates/actions/workflows/publish.yml/badge.svg)](https://github.com/Code0App/templates/actions/workflows/publish.yml)
[![Build Templates](https://github.com/Code0App/templates/actions/workflows/build.yml/badge.svg)](https://github.com/Code0App/templates/actions/workflows/build.yml)
[![Publish Templates](https://github.com/Code0App/templates/actions/workflows/publish.yml/badge.svg)](https://github.com/Code0App/templates/actions/workflows/publish.yml) [![Build Templates](https://github.com/Code0App/templates/actions/workflows/build.yml/badge.svg)](https://github.com/Code0App/templates/actions/workflows/build.yml)

Sandbox images that power Code0 projects. These templates provide ready-to-run environments in E2B Cloud for building, previewing, and iterating on code generated by the app.

Expand Down
4 changes: 2 additions & 2 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This folder contains E2B sandbox templates used to spin up ephemeral environment
- If credentials were exposed (API keys, tokens), revoke/rotate them immediately and note this in your report.

## Scope
- Files under `sandbox/` (e.g., `nextjs/e2b.Dockerfile`, `e2b.toml`, shell scripts) and any artifacts they produce.
- Files under the root (e.g., `nextjs-shadcn/e2b.Dockerfile`, `e2b.toml`, shell scripts) and any artifacts they produce.
- Runtime commands defined in `start_cmd` and installed packages in the image.

## Best Practices for Contributors
Expand All @@ -20,7 +20,7 @@ This folder contains E2B sandbox templates used to spin up ephemeral environment
- Use LF line endings for shell scripts and verify with `bash -n` locally when possible.

## Supported Templates
- Actively maintained templates live under `sandbox/`. Templates without recent updates may receive limited security backports.
- Actively maintained templates live inside this repo. Templates without recent updates may receive limited security backports.

## Disclosure Timeline
- We aim to acknowledge within 3 business days and provide an initial assessment or mitigation plan within 10 business days.
2 changes: 1 addition & 1 deletion nextjs-radixui/e2b.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ RUN chmod +x /compile_page.sh
WORKDIR /tmp/app

# Create a fresh Next.js app (non-interactive)
RUN npx --yes create-next-app@15.3.3 . --yes
RUN npx --yes create-next-app@latest . --yes

# Install Radix UI component packages
RUN npm i --save \
Expand Down
4 changes: 2 additions & 2 deletions nextjs-radixui/e2b.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
# const sandbox = await Sandbox.create('code0-nextjsradixui')

team_id = "4465cfe3-5234-4e68-8099-a4df2df45079"
memory_mb = 8_192
cpu_count = 8
memory_mb = 4_192
cpu_count = 4
start_cmd = "/compile_page.sh"
dockerfile = "e2b.Dockerfile"
template_name = "code0-nextjsradixui"
Expand Down
6 changes: 3 additions & 3 deletions nextjs-shadcn/e2b.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ RUN chmod +x /compile_page.sh
# Install dependencies and customize sandbox in a temp directory
WORKDIR /tmp/app

RUN npx --yes create-next-app@15.3.3 . --yes
RUN npx --yes create-next-app@latest . --yes

RUN npx --yes shadcn@2.6.3 init --yes -b neutral --force
RUN npx --yes shadcn@2.6.3 add --all --yes
RUN npx --yes shadcn@latest init --yes -b neutral --force
RUN npx --yes shadcn@latest add --all --yes

# Copy everything (including dotfiles) to /home/user and remove temp dir to avoid nesting
RUN mkdir -p /home/user \
Expand Down
4 changes: 2 additions & 2 deletions nextjs-shadcn/e2b.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
# const sandbox = await Sandbox.create('code0-nextjsshadcn')

team_id = "4465cfe3-5234-4e68-8099-a4df2df45079"
memory_mb = 8_192
cpu_count = 8
memory_mb = 4_192
cpu_count = 4
start_cmd = "/compile_page.sh"
dockerfile = "e2b.Dockerfile"
template_name = "code0-nextjsshadcn"
Expand Down
20 changes: 20 additions & 0 deletions nextjs-tailwind/compile_page.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

# This script runs during building the sandbox template
# and makes sure the Next.js app is (1) running and (2) the `/` page is compiled
function ping_server() {
counter=0
response=$(curl -s -o /dev/null -w "%{http_code}" "http://localhost:3000")
while [[ ${response} -ne 200 ]]; do
let counter++
if (( counter % 20 == 0 )); then
echo "Waiting for server to start..."
sleep 0.1
fi

response=$(curl -s -o /dev/null -w "%{http_code}" "http://localhost:3000")
done
}

ping_server &
cd /home/user && npx next dev --turbopack
19 changes: 19 additions & 0 deletions nextjs-tailwind/e2b.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# You can use most Debian-based base images
FROM node:21-slim

# Install curl
RUN apt-get update && apt-get install -y curl && apt-get clean && rm -rf /var/lib/apt/lists/*

COPY compile_page.sh /compile_page.sh
RUN chmod +x /compile_page.sh

# Install dependencies and customize sandbox in a temp directory
WORKDIR /tmp/app

# Create a fresh Next.js app with TailwindCSS (non-interactive)
RUN npx --yes create-next-app@latest . --yes

# Copy everything (including dotfiles) to /home/user and remove temp dir to avoid nesting
RUN mkdir -p /home/user \
&& cp -a /tmp/app/. /home/user/ \
&& rm -rf /tmp/app
19 changes: 19 additions & 0 deletions nextjs-tailwind/e2b.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# This is a config for E2B sandbox template.
# You can use template ID (zv80q8qolj5icz4kwejc) or template name (code0-nextjstailwind) to create a sandbox:

# Python SDK
# from e2b import Sandbox, AsyncSandbox
# sandbox = Sandbox("code0-nextjstailwind") # Sync sandbox
# sandbox = await AsyncSandbox.create("code0-nextjstailwind") # Async sandbox

# JS SDK
# import { Sandbox } from 'e2b'
# const sandbox = await Sandbox.create('code0-nextjstailwind')

team_id = "4465cfe3-5234-4e68-8099-a4df2df45079"
memory_mb = 4_192
cpu_count = 4
start_cmd = "/compile_page.sh"
dockerfile = "e2b.Dockerfile"
template_name = "code0-nextjstailwind"
template_id = "zv80q8qolj5icz4kwejc"
2 changes: 1 addition & 1 deletion scripts/build-and-publish.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ async function main() {
}
if (!mode || mode === 'publish' || mode === 'all' || mode === '') {
console.log(`\n=== Publishing: ${t} ===`);
await run('e2b', ['template', 'publish'], t);
await run('e2b', ['template', 'publish', '--yes'], t);
}
}

Expand Down