Skip to content

Commit 9f9a423

Browse files
authored
Updated template with SWC compiler for TypeScript (#97)
* updated template with SWC compiler * added changeset
1 parent 3be5d22 commit 9f9a423

File tree

4 files changed

+38
-4
lines changed

4 files changed

+38
-4
lines changed

.changeset/dull-flies-bow.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@e2b/code-interpreter-template': patch
3+
---
4+
5+
added swc compiler for TypeScript

template/.ts.swcrc

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"$schema": "https://swc.rs/schema.json",
3+
"jsc": {
4+
"parser": {
5+
"syntax": "typescript"
6+
}
7+
},
8+
"module": {
9+
"type": "commonjs"
10+
},
11+
"env": {
12+
"targets": "node 20"
13+
},
14+
"isModule": false
15+
}

template/Dockerfile

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
FROM python:3.10.14
22

33
RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y --no-install-recommends \
4-
build-essential curl git util-linux jq sudo nodejs npm fonts-noto-cjk
4+
build-essential curl git util-linux jq sudo fonts-noto-cjk
5+
6+
# Install Node.js 20.x from NodeSource
7+
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
8+
apt-get install -y nodejs
59

610
ENV PIP_DEFAULT_TIMEOUT=100 \
711
PIP_DISABLE_PIP_VERSION_CHECK=1 \
@@ -24,10 +28,13 @@ RUN R -e "install.packages('IRkernel', repos='https://cloud.r-project.org')"
2428
RUN R -e "IRkernel::installspec(user = FALSE, name = 'r', displayname = 'R')"
2529

2630
# Javascript Kernel
27-
RUN npm install -g node-gyp
2831
RUN npm install -g --unsafe-perm ijavascript
2932
RUN ijsinstall --install=global
3033

34+
## TypeScript compiler
35+
RUN npm install -g @swc/cli @swc/core
36+
COPY .ts.swcrc $SERVER_PATH/.ts.swcrc
37+
3138
# Deno Kernel
3239
COPY --from=denoland/deno:bin-2.0.4 /deno /usr/bin/deno
3340
RUN chmod +x /usr/bin/deno

template/test.Dockerfile

+9-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ COPY --from=eclipse-temurin:11-jdk $JAVA_HOME $JAVA_HOME
55
ENV PATH="${JAVA_HOME}/bin:${PATH}"
66

77
RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y --no-install-recommends \
8-
build-essential curl git util-linux jq sudo nodejs npm fonts-noto-cjk
8+
build-essential curl git util-linux jq sudo fonts-noto-cjk
9+
10+
# Install Node.js 20.x from NodeSource
11+
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
12+
apt-get install -y nodejs
913

1014
ENV PIP_DEFAULT_TIMEOUT=100 \
1115
PIP_DISABLE_PIP_VERSION_CHECK=1 \
@@ -19,10 +23,13 @@ COPY ./template/requirements.txt requirements.txt
1923
RUN pip install --no-cache-dir -r requirements.txt && ipython kernel install --name "python3" --user
2024

2125
# Javascript Kernel
22-
RUN npm install -g node-gyp
2326
RUN npm install -g --unsafe-perm ijavascript
2427
RUN ijsinstall --install=global
2528

29+
## TypeScript compiler
30+
RUN npm install -g @swc/cli @swc/core
31+
COPY ./template/.ts.swcrc $SERVER_PATH/.ts.swcrc
32+
2633
# Deno Kernel
2734
COPY --from=denoland/deno:bin-2.0.4 /deno /usr/bin/deno
2835
RUN chmod +x /usr/bin/deno

0 commit comments

Comments
 (0)