Skip to content

Instantly share code, notes, and snippets.

@FrancescoSaverioZuppichini
Created January 15, 2026 15:36
Show Gist options
  • Select an option

  • Save FrancescoSaverioZuppichini/b2aa286985d22847498e4754b7ac2041 to your computer and use it in GitHub Desktop.

Select an option

Save FrancescoSaverioZuppichini/b2aa286985d22847498e4754b7ac2041 to your computer and use it in GitHub Desktop.
e2b-nextjs-developer
# You can use most Debian-based base images
FROM e2bdev/code-interpreter:latest
# Install curl
RUN apt-get update && apt-get install -y curl && apt-get clean && rm -rf /var/lib/apt/lists/*
ENV BUN_NO_INSTALL_CONFIRMATION=1
# Install Bun 1.2.x
RUN curl -fsSL https://bun.sh/install | bash -s "bun-v1.2.21" && \
mv /root/.bun/bin/bun /usr/local/bin/ && \
ln -s /usr/local/bin/bun /usr/local/bin/bunx
WORKDIR /home/user
RUN bunx create-next-app@15.5.0 . --ts --tailwind --no-eslint --import-alias "@/*" --yes
RUN bunx shadcn@2.10.0 init -b neutral -y
RUN bunx shadcn@2.10.0 add --all
RUN bun add -g typescript
COPY start.sh /home/user/start.sh
RUN chmod +x /home/user/start.sh
# This is a config for E2B sandbox template.
# You can use template ID (6el1c1ckdh9yy320dlbq) or template name (dlai-nextjs-developer) to create a sandbox:
# Python SDK
# from e2b import Sandbox, AsyncSandbox
# sandbox = Sandbox("dlai-nextjs-developer") # Sync sandbox
# sandbox = await AsyncSandbox.create("dlai-nextjs-developer") # Async sandbox
# JS SDK
# import { Sandbox } from 'e2b'
# const sandbox = await Sandbox.create('dlai-nextjs-developer')
team_id = "YOUR_TEAM_ID"
memory_mb = 4_096
cpu_count = 4
start_cmd = "/home/user/start.sh"
dockerfile = "e2b.Dockerfile"
template_name = "dlai-nextjs-developer"
template_id = "6el1c1ckdh9yy320dlbq"
#!/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 &
/root/.jupyter/start-up.sh &
cd /home/user && bun run dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment