@cloudflare/sandbox 0.0.8 → 0.0.9
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/CHANGELOG.md +6 -0
- package/Dockerfile +86 -9
- package/container_src/index.ts +428 -82
- package/dist/{chunk-7WZJ3TRE.js → chunk-4J5LQCCN.js} +85 -3
- package/dist/chunk-4J5LQCCN.js.map +1 -0
- package/dist/chunk-5SZ3RVJZ.js +250 -0
- package/dist/chunk-5SZ3RVJZ.js.map +1 -0
- package/dist/client-BuVjqV00.d.ts +247 -0
- package/dist/client.d.ts +1 -1
- package/dist/client.js +1 -1
- package/dist/index.d.ts +3 -200
- package/dist/index.js +7 -106
- package/dist/index.js.map +1 -1
- package/dist/request-handler.d.ts +15 -0
- package/dist/request-handler.js +10 -0
- package/dist/request-handler.js.map +1 -0
- package/dist/sandbox.d.ts +2 -0
- package/dist/sandbox.js +10 -0
- package/dist/sandbox.js.map +1 -0
- package/package.json +2 -2
- package/src/client.ts +163 -34
- package/src/index.ts +14 -136
- package/src/request-handler.ts +95 -0
- package/src/sandbox.ts +252 -0
- package/dist/chunk-7WZJ3TRE.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @cloudflare/sandbox
|
|
2
2
|
|
|
3
|
+
## 0.0.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#20](https://github.com/cloudflare/sandbox-sdk/pull/20) [`f106fda`](https://github.com/cloudflare/sandbox-sdk/commit/f106fdac98e7ef35677326290d45cbf3af88982c) Thanks [@ghostwriternr](https://github.com/ghostwriternr)! - add preview URLs and dynamic port forwarding
|
|
8
|
+
|
|
3
9
|
## 0.0.8
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/Dockerfile
CHANGED
|
@@ -1,16 +1,93 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Sandbox base image with development tools, Python, Node.js, and Bun
|
|
2
|
+
FROM ubuntu:22.04
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
4
|
+
# Prevent interactive prompts during package installation
|
|
5
|
+
ENV DEBIAN_FRONTEND=noninteractive
|
|
6
|
+
|
|
7
|
+
# Install essential system packages and development tools
|
|
8
|
+
RUN apt-get update && apt-get install -y \
|
|
9
|
+
# Basic utilities
|
|
10
|
+
curl \
|
|
11
|
+
wget \
|
|
12
|
+
git \
|
|
13
|
+
unzip \
|
|
14
|
+
zip \
|
|
15
|
+
# Process management
|
|
16
|
+
procps \
|
|
17
|
+
htop \
|
|
18
|
+
# Build tools
|
|
19
|
+
build-essential \
|
|
20
|
+
pkg-config \
|
|
21
|
+
# Network tools
|
|
22
|
+
net-tools \
|
|
23
|
+
iputils-ping \
|
|
24
|
+
dnsutils \
|
|
25
|
+
# Text processing
|
|
26
|
+
jq \
|
|
27
|
+
vim \
|
|
28
|
+
nano \
|
|
29
|
+
# Python dependencies
|
|
30
|
+
python3.11 \
|
|
31
|
+
python3.11-dev \
|
|
32
|
+
python3-pip \
|
|
33
|
+
# Other useful tools
|
|
34
|
+
sudo \
|
|
35
|
+
ca-certificates \
|
|
36
|
+
gnupg \
|
|
37
|
+
lsb-release \
|
|
38
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
39
|
+
|
|
40
|
+
# Set Python 3.11 as default python3
|
|
41
|
+
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 1
|
|
42
|
+
|
|
43
|
+
# Install Node.js 22 LTS
|
|
44
|
+
# Using the official NodeSource repository setup script
|
|
45
|
+
RUN apt-get update && apt-get install -y ca-certificates curl gnupg \
|
|
46
|
+
&& mkdir -p /etc/apt/keyrings \
|
|
47
|
+
&& curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \
|
|
48
|
+
&& echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_22.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list \
|
|
49
|
+
&& apt-get update \
|
|
50
|
+
&& apt-get install -y nodejs \
|
|
51
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
52
|
+
|
|
53
|
+
# Install Bun using the official installation script
|
|
54
|
+
RUN curl -fsSL https://bun.sh/install | bash \
|
|
55
|
+
&& mv /root/.bun/bin/bun /usr/local/bin/bun \
|
|
56
|
+
&& mv /root/.bun/bin/bunx /usr/local/bin/bunx \
|
|
57
|
+
&& rm -rf /root/.bun
|
|
58
|
+
|
|
59
|
+
# Install global npm packages as root
|
|
60
|
+
RUN npm install -g yarn pnpm
|
|
61
|
+
|
|
62
|
+
# Create a non-root user for running applications
|
|
63
|
+
RUN useradd -m -s /bin/bash sandbox \
|
|
64
|
+
&& echo "sandbox ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
|
|
65
|
+
|
|
66
|
+
# Set up working directory
|
|
5
67
|
WORKDIR /app
|
|
6
68
|
|
|
7
|
-
#
|
|
8
|
-
RUN
|
|
69
|
+
# Set ownership of the app directory to sandbox user
|
|
70
|
+
RUN chown -R sandbox:sandbox /app
|
|
71
|
+
|
|
72
|
+
# Set environment variables
|
|
73
|
+
ENV PATH="/home/sandbox/.local/bin:${PATH}"
|
|
74
|
+
|
|
75
|
+
# Switch to non-root user
|
|
76
|
+
USER sandbox
|
|
9
77
|
|
|
10
|
-
|
|
11
|
-
|
|
78
|
+
# Verify installations
|
|
79
|
+
RUN python3 --version && \
|
|
80
|
+
node --version && \
|
|
81
|
+
npm --version && \
|
|
82
|
+
bun --version && \
|
|
83
|
+
yarn --version && \
|
|
84
|
+
pnpm --version
|
|
12
85
|
|
|
86
|
+
# Copy container source files
|
|
87
|
+
COPY --chown=sandbox:sandbox container_src/* ./
|
|
88
|
+
|
|
89
|
+
# Expose the application port
|
|
13
90
|
EXPOSE 3000
|
|
14
|
-
# Run
|
|
15
|
-
CMD ["bun", "index.ts"]
|
|
16
91
|
|
|
92
|
+
# Run the application
|
|
93
|
+
CMD ["bun", "index.ts"]
|