sandboxbox 2.0.4 → 2.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/0.60 +0 -0
- package/Dockerfile +94 -94
- package/README.md +242 -242
- package/cli.js +341 -277
- package/npx-test/package.json +1 -0
- package/package.json +38 -38
- package/scripts/download-podman.js +237 -148
- package/test/Dockerfile +19 -0
- package/test/index.js +16 -0
- package/test/package.json +13 -0
- package/bin/.gitkeep +0 -1
package/0.60
ADDED
File without changes
|
package/Dockerfile
CHANGED
@@ -1,95 +1,95 @@
|
|
1
|
-
FROM node:20
|
2
|
-
|
3
|
-
ARG TZ
|
4
|
-
ENV TZ="$TZ"
|
5
|
-
|
6
|
-
ARG CLAUDE_CODE_VERSION=latest
|
7
|
-
|
8
|
-
# Install basic development tools and iptables/ipset
|
9
|
-
RUN apt-get update && apt-get install -y --no-install-recommends \
|
10
|
-
less \
|
11
|
-
git \
|
12
|
-
procps \
|
13
|
-
sudo \
|
14
|
-
fzf \
|
15
|
-
zsh \
|
16
|
-
man-db \
|
17
|
-
unzip \
|
18
|
-
gnupg2 \
|
19
|
-
gh \
|
20
|
-
iptables \
|
21
|
-
ipset \
|
22
|
-
iproute2 \
|
23
|
-
dnsutils \
|
24
|
-
aggregate \
|
25
|
-
jq \
|
26
|
-
nano \
|
27
|
-
vim \
|
28
|
-
&& apt-get clean && rm -rf /var/lib/apt/lists/*
|
29
|
-
|
30
|
-
# Ensure default node user has access to /usr/local/share
|
31
|
-
RUN mkdir -p /usr/local/share/npm-global && \
|
32
|
-
chown -R node:node /usr/local/share
|
33
|
-
|
34
|
-
ARG USERNAME=node
|
35
|
-
|
36
|
-
# Persist bash history.
|
37
|
-
RUN SNIPPET="export PROMPT_COMMAND='history -a' && export HISTFILE=/commandhistory/.bash_history" \
|
38
|
-
&& mkdir -p /commandhistory \
|
39
|
-
&& touch /commandhistory/.bash_history \
|
40
|
-
&& chown -R $USERNAME /commandhistory
|
41
|
-
|
42
|
-
# Set `DEVCONTAINER` environment variable to help with orientation
|
43
|
-
ENV DEVCONTAINER=true
|
44
|
-
|
45
|
-
# Create workspace and config directories and set permissions
|
46
|
-
RUN mkdir -p /workspace /home/node/.claude && \
|
47
|
-
chown -R node:node /workspace /home/node/.claude
|
48
|
-
|
49
|
-
WORKDIR /workspace
|
50
|
-
|
51
|
-
ARG GIT_DELTA_VERSION=0.18.2
|
52
|
-
RUN ARCH=$(dpkg --print-architecture) && \
|
53
|
-
wget "https://github.com/dandavison/delta/releases/download/${GIT_DELTA_VERSION}/git-delta_${GIT_DELTA_VERSION}_${ARCH}.deb" && \
|
54
|
-
sudo dpkg -i "git-delta_${GIT_DELTA_VERSION}_${ARCH}.deb" && \
|
55
|
-
rm "git-delta_${GIT_DELTA_VERSION}_${ARCH}.deb"
|
56
|
-
|
57
|
-
# Set up non-root user
|
58
|
-
USER node
|
59
|
-
|
60
|
-
# Install global packages
|
61
|
-
ENV NPM_CONFIG_PREFIX=/usr/local/share/npm-global
|
62
|
-
ENV PATH=$PATH:/usr/local/share/npm-global/bin
|
63
|
-
|
64
|
-
# Set the default shell to zsh rather than sh
|
65
|
-
ENV SHELL=/bin/zsh
|
66
|
-
|
67
|
-
# Set the default editor and visual
|
68
|
-
ENV EDITOR=nano
|
69
|
-
ENV VISUAL=nano
|
70
|
-
|
71
|
-
# Default powerline10k theme
|
72
|
-
ARG ZSH_IN_DOCKER_VERSION=1.2.0
|
73
|
-
RUN sh -c "$(wget -O- https://github.com/deluan/zsh-in-docker/releases/download/v${ZSH_IN_DOCKER_VERSION}/zsh-in-docker.sh)" -- \
|
74
|
-
-p git \
|
75
|
-
-p fzf \
|
76
|
-
-a "source /usr/share/doc/fzf/examples/key-bindings.zsh" \
|
77
|
-
-a "source /usr/share/doc/fzf/examples/completion.zsh" \
|
78
|
-
-a "export PROMPT_COMMAND='history -a' && export HISTFILE=/commandhistory/.bash_history" \
|
79
|
-
-x
|
80
|
-
|
81
|
-
# Install Claude
|
82
|
-
RUN npm install -g @anthropic-ai/claude-code@${CLAUDE_CODE_VERSION}
|
83
|
-
|
84
|
-
# Install playwright deps
|
85
|
-
RUN npx --yes playwright install-deps
|
86
|
-
|
87
|
-
RUN npm i -g @playwright/mcp
|
88
|
-
|
89
|
-
# Copy and set up firewall script
|
90
|
-
COPY init-firewall.sh /usr/local/bin/
|
91
|
-
USER root
|
92
|
-
RUN chmod +x /usr/local/bin/init-firewall.sh && \
|
93
|
-
echo "node ALL=(root) NOPASSWD: /usr/local/bin/init-firewall.sh" > /etc/sudoers.d/node-firewall && \
|
94
|
-
chmod 0440 /etc/sudoers.d/node-firewall
|
1
|
+
FROM node:20
|
2
|
+
|
3
|
+
ARG TZ
|
4
|
+
ENV TZ="$TZ"
|
5
|
+
|
6
|
+
ARG CLAUDE_CODE_VERSION=latest
|
7
|
+
|
8
|
+
# Install basic development tools and iptables/ipset
|
9
|
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
10
|
+
less \
|
11
|
+
git \
|
12
|
+
procps \
|
13
|
+
sudo \
|
14
|
+
fzf \
|
15
|
+
zsh \
|
16
|
+
man-db \
|
17
|
+
unzip \
|
18
|
+
gnupg2 \
|
19
|
+
gh \
|
20
|
+
iptables \
|
21
|
+
ipset \
|
22
|
+
iproute2 \
|
23
|
+
dnsutils \
|
24
|
+
aggregate \
|
25
|
+
jq \
|
26
|
+
nano \
|
27
|
+
vim \
|
28
|
+
&& apt-get clean && rm -rf /var/lib/apt/lists/*
|
29
|
+
|
30
|
+
# Ensure default node user has access to /usr/local/share
|
31
|
+
RUN mkdir -p /usr/local/share/npm-global && \
|
32
|
+
chown -R node:node /usr/local/share
|
33
|
+
|
34
|
+
ARG USERNAME=node
|
35
|
+
|
36
|
+
# Persist bash history.
|
37
|
+
RUN SNIPPET="export PROMPT_COMMAND='history -a' && export HISTFILE=/commandhistory/.bash_history" \
|
38
|
+
&& mkdir -p /commandhistory \
|
39
|
+
&& touch /commandhistory/.bash_history \
|
40
|
+
&& chown -R $USERNAME /commandhistory
|
41
|
+
|
42
|
+
# Set `DEVCONTAINER` environment variable to help with orientation
|
43
|
+
ENV DEVCONTAINER=true
|
44
|
+
|
45
|
+
# Create workspace and config directories and set permissions
|
46
|
+
RUN mkdir -p /workspace /home/node/.claude && \
|
47
|
+
chown -R node:node /workspace /home/node/.claude
|
48
|
+
|
49
|
+
WORKDIR /workspace
|
50
|
+
|
51
|
+
ARG GIT_DELTA_VERSION=0.18.2
|
52
|
+
RUN ARCH=$(dpkg --print-architecture) && \
|
53
|
+
wget "https://github.com/dandavison/delta/releases/download/${GIT_DELTA_VERSION}/git-delta_${GIT_DELTA_VERSION}_${ARCH}.deb" && \
|
54
|
+
sudo dpkg -i "git-delta_${GIT_DELTA_VERSION}_${ARCH}.deb" && \
|
55
|
+
rm "git-delta_${GIT_DELTA_VERSION}_${ARCH}.deb"
|
56
|
+
|
57
|
+
# Set up non-root user
|
58
|
+
USER node
|
59
|
+
|
60
|
+
# Install global packages
|
61
|
+
ENV NPM_CONFIG_PREFIX=/usr/local/share/npm-global
|
62
|
+
ENV PATH=$PATH:/usr/local/share/npm-global/bin
|
63
|
+
|
64
|
+
# Set the default shell to zsh rather than sh
|
65
|
+
ENV SHELL=/bin/zsh
|
66
|
+
|
67
|
+
# Set the default editor and visual
|
68
|
+
ENV EDITOR=nano
|
69
|
+
ENV VISUAL=nano
|
70
|
+
|
71
|
+
# Default powerline10k theme
|
72
|
+
ARG ZSH_IN_DOCKER_VERSION=1.2.0
|
73
|
+
RUN sh -c "$(wget -O- https://github.com/deluan/zsh-in-docker/releases/download/v${ZSH_IN_DOCKER_VERSION}/zsh-in-docker.sh)" -- \
|
74
|
+
-p git \
|
75
|
+
-p fzf \
|
76
|
+
-a "source /usr/share/doc/fzf/examples/key-bindings.zsh" \
|
77
|
+
-a "source /usr/share/doc/fzf/examples/completion.zsh" \
|
78
|
+
-a "export PROMPT_COMMAND='history -a' && export HISTFILE=/commandhistory/.bash_history" \
|
79
|
+
-x
|
80
|
+
|
81
|
+
# Install Claude
|
82
|
+
RUN npm install -g @anthropic-ai/claude-code@${CLAUDE_CODE_VERSION}
|
83
|
+
|
84
|
+
# Install playwright deps
|
85
|
+
RUN npx --yes playwright install-deps
|
86
|
+
|
87
|
+
RUN npm i -g @playwright/mcp
|
88
|
+
|
89
|
+
# Copy and set up firewall script
|
90
|
+
COPY init-firewall.sh /usr/local/bin/
|
91
|
+
USER root
|
92
|
+
RUN chmod +x /usr/local/bin/init-firewall.sh && \
|
93
|
+
echo "node ALL=(root) NOPASSWD: /usr/local/bin/init-firewall.sh" > /etc/sudoers.d/node-firewall && \
|
94
|
+
chmod 0440 /etc/sudoers.d/node-firewall
|
95
95
|
USER node
|
package/README.md
CHANGED
@@ -1,242 +1,242 @@
|
|
1
|
-
# SandboxBox
|
2
|
-
|
3
|
-
**Cross-platform container runner with Claude Code and Playwright support**
|
4
|
-
|
5
|
-
Run your projects in isolated containers using Podman. Works on **Windows, macOS, and Linux**.
|
6
|
-
|
7
|
-
## Installation
|
8
|
-
|
9
|
-
No installation required! **Podman binaries auto-download** on first use:
|
10
|
-
|
11
|
-
```bash
|
12
|
-
npx sandboxbox build
|
13
|
-
npx sandboxbox run ./my-project
|
14
|
-
```
|
15
|
-
|
16
|
-
### Auto-Download Feature
|
17
|
-
|
18
|
-
SandboxBox automatically downloads portable Podman binaries when you run it:
|
19
|
-
- ✅ **Windows** - Downloads podman.exe (v4.9.3)
|
20
|
-
- ✅ **macOS** - Downloads podman remote client
|
21
|
-
- ✅ **Linux** - Downloads static podman binary
|
22
|
-
|
23
|
-
Just like sqlite or Playwright, no manual installation needed!
|
24
|
-
|
25
|
-
### Manual Installation (Optional)
|
26
|
-
|
27
|
-
If you prefer to install Podman system-wide:
|
28
|
-
|
29
|
-
**Windows:**
|
30
|
-
```powershell
|
31
|
-
winget install RedHat.Podman
|
32
|
-
```
|
33
|
-
|
34
|
-
**macOS:**
|
35
|
-
```bash
|
36
|
-
brew install podman
|
37
|
-
podman machine init
|
38
|
-
podman machine start
|
39
|
-
```
|
40
|
-
|
41
|
-
**Linux:**
|
42
|
-
```bash
|
43
|
-
sudo apt-get install podman # Ubuntu/Debian
|
44
|
-
sudo dnf install podman # Fedora
|
45
|
-
sudo apk add podman # Alpine
|
46
|
-
```
|
47
|
-
|
48
|
-
## Quick Start
|
49
|
-
|
50
|
-
### 1. Build Container
|
51
|
-
|
52
|
-
```bash
|
53
|
-
npx sandboxbox build
|
54
|
-
```
|
55
|
-
|
56
|
-
This builds a container with:
|
57
|
-
- Node.js v22
|
58
|
-
- Claude Code CLI
|
59
|
-
- Playwright with all browser dependencies
|
60
|
-
- Git, npm, and essential build tools
|
61
|
-
|
62
|
-
### 2. Run Your Project
|
63
|
-
|
64
|
-
```bash
|
65
|
-
# Run with default shell
|
66
|
-
npx sandboxbox run ./my-project
|
67
|
-
|
68
|
-
# Run custom command
|
69
|
-
npx sandboxbox run ./my-project "npm test"
|
70
|
-
|
71
|
-
# Run Claude Code
|
72
|
-
npx sandboxbox run ./my-project "claude --help"
|
73
|
-
|
74
|
-
# Run Playwright tests
|
75
|
-
npx sandboxbox run ./my-project "npx playwright test"
|
76
|
-
```
|
77
|
-
|
78
|
-
### 3. Interactive Shell
|
79
|
-
|
80
|
-
```bash
|
81
|
-
npx sandboxbox shell ./my-project
|
82
|
-
```
|
83
|
-
|
84
|
-
## Features
|
85
|
-
|
86
|
-
### 🌍 Cross-Platform
|
87
|
-
- **Windows** - Full support with Podman Desktop
|
88
|
-
- **macOS** - Works with Podman machine
|
89
|
-
- **Linux** - Native Podman support
|
90
|
-
|
91
|
-
### 🔒 Isolation
|
92
|
-
- Complete container isolation
|
93
|
-
- Your host system stays clean
|
94
|
-
- Workspace mounted at `/workspace`
|
95
|
-
|
96
|
-
### 🚀 Pre-installed Tools
|
97
|
-
- **Node.js v22**
|
98
|
-
- **Claude Code CLI** - AI-powered development
|
99
|
-
- **Playwright** - Browser automation with all dependencies
|
100
|
-
- **Git** - Version control
|
101
|
-
- **npm** - Package management
|
102
|
-
|
103
|
-
### 📦 NPX-First Design
|
104
|
-
- No global installation needed
|
105
|
-
- Single command execution
|
106
|
-
- Works with any project directory
|
107
|
-
|
108
|
-
## Commands
|
109
|
-
|
110
|
-
```bash
|
111
|
-
# Build container from Dockerfile
|
112
|
-
npx sandboxbox build
|
113
|
-
npx sandboxbox build ./Dockerfile.custom
|
114
|
-
|
115
|
-
# Run project in container
|
116
|
-
npx sandboxbox run <project-dir> [command]
|
117
|
-
|
118
|
-
# Interactive shell
|
119
|
-
npx sandboxbox shell <project-dir>
|
120
|
-
|
121
|
-
# Show version
|
122
|
-
npx sandboxbox version
|
123
|
-
```
|
124
|
-
|
125
|
-
## How It Works
|
126
|
-
|
127
|
-
1. **Builds** a container image from the Dockerfile using Podman
|
128
|
-
2. **Mounts** your project directory to `/workspace` in the container
|
129
|
-
3. **Runs** your command in the isolated container environment
|
130
|
-
4. **Removes** the container automatically when done
|
131
|
-
|
132
|
-
```
|
133
|
-
Your Project Container
|
134
|
-
./my-project ━━━━━> /workspace
|
135
|
-
(host) (isolated)
|
136
|
-
```
|
137
|
-
|
138
|
-
## Use Cases
|
139
|
-
|
140
|
-
### Run Claude Code
|
141
|
-
```bash
|
142
|
-
npx sandboxbox run ./my-app "claude --version"
|
143
|
-
npx sandboxbox run ./my-app "claude code review lib/"
|
144
|
-
```
|
145
|
-
|
146
|
-
### Run Playwright Tests
|
147
|
-
```bash
|
148
|
-
npx sandboxbox run ./my-app "npx playwright test"
|
149
|
-
npx sandboxbox run ./my-app "npx playwright test --headed"
|
150
|
-
```
|
151
|
-
|
152
|
-
### Development Workflow
|
153
|
-
```bash
|
154
|
-
# Build once
|
155
|
-
npx sandboxbox build
|
156
|
-
|
157
|
-
# Interactive development
|
158
|
-
npx sandboxbox shell ./my-app
|
159
|
-
|
160
|
-
# Inside container:
|
161
|
-
npm install
|
162
|
-
npm test
|
163
|
-
git commit -am "Update"
|
164
|
-
exit
|
165
|
-
```
|
166
|
-
|
167
|
-
### Run npm Scripts
|
168
|
-
```bash
|
169
|
-
npx sandboxbox run ./my-app "npm run build"
|
170
|
-
npx sandboxbox run ./my-app "npm run lint"
|
171
|
-
npx sandboxbox run ./my-app "npm run test:e2e"
|
172
|
-
```
|
173
|
-
|
174
|
-
## Custom Dockerfile
|
175
|
-
|
176
|
-
Create your own `Dockerfile`:
|
177
|
-
|
178
|
-
```dockerfile
|
179
|
-
FROM node:22-alpine
|
180
|
-
|
181
|
-
# Install system dependencies
|
182
|
-
RUN apk add --no-cache git bash curl
|
183
|
-
|
184
|
-
# Install global packages
|
185
|
-
RUN npm install -g @anthropic-ai/claude-code @playwright/test
|
186
|
-
|
187
|
-
# Install Playwright browsers
|
188
|
-
RUN npx playwright install --with-deps chromium
|
189
|
-
|
190
|
-
WORKDIR /workspace
|
191
|
-
|
192
|
-
CMD ["/bin/bash"]
|
193
|
-
```
|
194
|
-
|
195
|
-
Then build:
|
196
|
-
```bash
|
197
|
-
npx sandboxbox build ./Dockerfile
|
198
|
-
```
|
199
|
-
|
200
|
-
## Requirements
|
201
|
-
|
202
|
-
- **Podman** (https://podman.io/getting-started/installation)
|
203
|
-
- **Node.js 16+** (for running npx)
|
204
|
-
|
205
|
-
## Project Structure
|
206
|
-
|
207
|
-
```
|
208
|
-
sandboxbox/
|
209
|
-
├── cli.js # Main CLI - Podman integration
|
210
|
-
├── Dockerfile # Container definition
|
211
|
-
├── package.json # NPM package config
|
212
|
-
└── README.md # This file
|
213
|
-
```
|
214
|
-
|
215
|
-
## Why Podman?
|
216
|
-
|
217
|
-
- ✅ **Cross-platform** - Works on Windows, macOS, Linux
|
218
|
-
- ✅ **Rootless** - No daemon, runs as regular user
|
219
|
-
- ✅ **Docker-compatible** - Uses OCI standard containers
|
220
|
-
- ✅ **Secure** - Better security model than Docker
|
221
|
-
- ✅ **Fast** - Lightweight and efficient
|
222
|
-
|
223
|
-
## Differences from v1.x
|
224
|
-
|
225
|
-
**v1.x (bubblewrap):**
|
226
|
-
- Linux-only
|
227
|
-
- Required bubblewrap installation
|
228
|
-
- Direct process isolation
|
229
|
-
|
230
|
-
**v2.x (Podman):**
|
231
|
-
- Cross-platform (Windows/macOS/Linux)
|
232
|
-
- Uses Podman containers
|
233
|
-
- OCI-standard container images
|
234
|
-
- More portable and widely supported
|
235
|
-
|
236
|
-
## License
|
237
|
-
|
238
|
-
MIT
|
239
|
-
|
240
|
-
## Contributing
|
241
|
-
|
242
|
-
Contributions welcome! This project focuses on cross-platform container execution with Claude Code and Playwright support using Podman.
|
1
|
+
# SandboxBox
|
2
|
+
|
3
|
+
**Cross-platform container runner with Claude Code and Playwright support**
|
4
|
+
|
5
|
+
Run your projects in isolated containers using Podman. Works on **Windows, macOS, and Linux**.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
No installation required! **Podman binaries auto-download** on first use:
|
10
|
+
|
11
|
+
```bash
|
12
|
+
npx sandboxbox build
|
13
|
+
npx sandboxbox run ./my-project
|
14
|
+
```
|
15
|
+
|
16
|
+
### Auto-Download Feature
|
17
|
+
|
18
|
+
SandboxBox automatically downloads portable Podman binaries when you run it:
|
19
|
+
- ✅ **Windows** - Downloads podman.exe (v4.9.3)
|
20
|
+
- ✅ **macOS** - Downloads podman remote client
|
21
|
+
- ✅ **Linux** - Downloads static podman binary
|
22
|
+
|
23
|
+
Just like sqlite or Playwright, no manual installation needed!
|
24
|
+
|
25
|
+
### Manual Installation (Optional)
|
26
|
+
|
27
|
+
If you prefer to install Podman system-wide:
|
28
|
+
|
29
|
+
**Windows:**
|
30
|
+
```powershell
|
31
|
+
winget install RedHat.Podman
|
32
|
+
```
|
33
|
+
|
34
|
+
**macOS:**
|
35
|
+
```bash
|
36
|
+
brew install podman
|
37
|
+
podman machine init
|
38
|
+
podman machine start
|
39
|
+
```
|
40
|
+
|
41
|
+
**Linux:**
|
42
|
+
```bash
|
43
|
+
sudo apt-get install podman # Ubuntu/Debian
|
44
|
+
sudo dnf install podman # Fedora
|
45
|
+
sudo apk add podman # Alpine
|
46
|
+
```
|
47
|
+
|
48
|
+
## Quick Start
|
49
|
+
|
50
|
+
### 1. Build Container
|
51
|
+
|
52
|
+
```bash
|
53
|
+
npx sandboxbox build
|
54
|
+
```
|
55
|
+
|
56
|
+
This builds a container with:
|
57
|
+
- Node.js v22
|
58
|
+
- Claude Code CLI
|
59
|
+
- Playwright with all browser dependencies
|
60
|
+
- Git, npm, and essential build tools
|
61
|
+
|
62
|
+
### 2. Run Your Project
|
63
|
+
|
64
|
+
```bash
|
65
|
+
# Run with default shell
|
66
|
+
npx sandboxbox run ./my-project
|
67
|
+
|
68
|
+
# Run custom command
|
69
|
+
npx sandboxbox run ./my-project "npm test"
|
70
|
+
|
71
|
+
# Run Claude Code
|
72
|
+
npx sandboxbox run ./my-project "claude --help"
|
73
|
+
|
74
|
+
# Run Playwright tests
|
75
|
+
npx sandboxbox run ./my-project "npx playwright test"
|
76
|
+
```
|
77
|
+
|
78
|
+
### 3. Interactive Shell
|
79
|
+
|
80
|
+
```bash
|
81
|
+
npx sandboxbox shell ./my-project
|
82
|
+
```
|
83
|
+
|
84
|
+
## Features
|
85
|
+
|
86
|
+
### 🌍 Cross-Platform
|
87
|
+
- **Windows** - Full support with Podman Desktop
|
88
|
+
- **macOS** - Works with Podman machine
|
89
|
+
- **Linux** - Native Podman support
|
90
|
+
|
91
|
+
### 🔒 Isolation
|
92
|
+
- Complete container isolation
|
93
|
+
- Your host system stays clean
|
94
|
+
- Workspace mounted at `/workspace`
|
95
|
+
|
96
|
+
### 🚀 Pre-installed Tools
|
97
|
+
- **Node.js v22**
|
98
|
+
- **Claude Code CLI** - AI-powered development
|
99
|
+
- **Playwright** - Browser automation with all dependencies
|
100
|
+
- **Git** - Version control
|
101
|
+
- **npm** - Package management
|
102
|
+
|
103
|
+
### 📦 NPX-First Design
|
104
|
+
- No global installation needed
|
105
|
+
- Single command execution
|
106
|
+
- Works with any project directory
|
107
|
+
|
108
|
+
## Commands
|
109
|
+
|
110
|
+
```bash
|
111
|
+
# Build container from Dockerfile
|
112
|
+
npx sandboxbox build
|
113
|
+
npx sandboxbox build ./Dockerfile.custom
|
114
|
+
|
115
|
+
# Run project in container
|
116
|
+
npx sandboxbox run <project-dir> [command]
|
117
|
+
|
118
|
+
# Interactive shell
|
119
|
+
npx sandboxbox shell <project-dir>
|
120
|
+
|
121
|
+
# Show version
|
122
|
+
npx sandboxbox version
|
123
|
+
```
|
124
|
+
|
125
|
+
## How It Works
|
126
|
+
|
127
|
+
1. **Builds** a container image from the Dockerfile using Podman
|
128
|
+
2. **Mounts** your project directory to `/workspace` in the container
|
129
|
+
3. **Runs** your command in the isolated container environment
|
130
|
+
4. **Removes** the container automatically when done
|
131
|
+
|
132
|
+
```
|
133
|
+
Your Project Container
|
134
|
+
./my-project ━━━━━> /workspace
|
135
|
+
(host) (isolated)
|
136
|
+
```
|
137
|
+
|
138
|
+
## Use Cases
|
139
|
+
|
140
|
+
### Run Claude Code
|
141
|
+
```bash
|
142
|
+
npx sandboxbox run ./my-app "claude --version"
|
143
|
+
npx sandboxbox run ./my-app "claude code review lib/"
|
144
|
+
```
|
145
|
+
|
146
|
+
### Run Playwright Tests
|
147
|
+
```bash
|
148
|
+
npx sandboxbox run ./my-app "npx playwright test"
|
149
|
+
npx sandboxbox run ./my-app "npx playwright test --headed"
|
150
|
+
```
|
151
|
+
|
152
|
+
### Development Workflow
|
153
|
+
```bash
|
154
|
+
# Build once
|
155
|
+
npx sandboxbox build
|
156
|
+
|
157
|
+
# Interactive development
|
158
|
+
npx sandboxbox shell ./my-app
|
159
|
+
|
160
|
+
# Inside container:
|
161
|
+
npm install
|
162
|
+
npm test
|
163
|
+
git commit -am "Update"
|
164
|
+
exit
|
165
|
+
```
|
166
|
+
|
167
|
+
### Run npm Scripts
|
168
|
+
```bash
|
169
|
+
npx sandboxbox run ./my-app "npm run build"
|
170
|
+
npx sandboxbox run ./my-app "npm run lint"
|
171
|
+
npx sandboxbox run ./my-app "npm run test:e2e"
|
172
|
+
```
|
173
|
+
|
174
|
+
## Custom Dockerfile
|
175
|
+
|
176
|
+
Create your own `Dockerfile`:
|
177
|
+
|
178
|
+
```dockerfile
|
179
|
+
FROM node:22-alpine
|
180
|
+
|
181
|
+
# Install system dependencies
|
182
|
+
RUN apk add --no-cache git bash curl
|
183
|
+
|
184
|
+
# Install global packages
|
185
|
+
RUN npm install -g @anthropic-ai/claude-code @playwright/test
|
186
|
+
|
187
|
+
# Install Playwright browsers
|
188
|
+
RUN npx playwright install --with-deps chromium
|
189
|
+
|
190
|
+
WORKDIR /workspace
|
191
|
+
|
192
|
+
CMD ["/bin/bash"]
|
193
|
+
```
|
194
|
+
|
195
|
+
Then build:
|
196
|
+
```bash
|
197
|
+
npx sandboxbox build ./Dockerfile
|
198
|
+
```
|
199
|
+
|
200
|
+
## Requirements
|
201
|
+
|
202
|
+
- **Podman** (https://podman.io/getting-started/installation)
|
203
|
+
- **Node.js 16+** (for running npx)
|
204
|
+
|
205
|
+
## Project Structure
|
206
|
+
|
207
|
+
```
|
208
|
+
sandboxbox/
|
209
|
+
├── cli.js # Main CLI - Podman integration
|
210
|
+
├── Dockerfile # Container definition
|
211
|
+
├── package.json # NPM package config
|
212
|
+
└── README.md # This file
|
213
|
+
```
|
214
|
+
|
215
|
+
## Why Podman?
|
216
|
+
|
217
|
+
- ✅ **Cross-platform** - Works on Windows, macOS, Linux
|
218
|
+
- ✅ **Rootless** - No daemon, runs as regular user
|
219
|
+
- ✅ **Docker-compatible** - Uses OCI standard containers
|
220
|
+
- ✅ **Secure** - Better security model than Docker
|
221
|
+
- ✅ **Fast** - Lightweight and efficient
|
222
|
+
|
223
|
+
## Differences from v1.x
|
224
|
+
|
225
|
+
**v1.x (bubblewrap):**
|
226
|
+
- Linux-only
|
227
|
+
- Required bubblewrap installation
|
228
|
+
- Direct process isolation
|
229
|
+
|
230
|
+
**v2.x (Podman):**
|
231
|
+
- Cross-platform (Windows/macOS/Linux)
|
232
|
+
- Uses Podman containers
|
233
|
+
- OCI-standard container images
|
234
|
+
- More portable and widely supported
|
235
|
+
|
236
|
+
## License
|
237
|
+
|
238
|
+
MIT
|
239
|
+
|
240
|
+
## Contributing
|
241
|
+
|
242
|
+
Contributions welcome! This project focuses on cross-platform container execution with Claude Code and Playwright support using Podman.
|