From b6be50e3a9d3d3e646f5047f68321bcc16aa32ce Mon Sep 17 00:00:00 2001 From: Jakub Dobry Date: Fri, 10 Oct 2025 11:15:05 +0200 Subject: [PATCH 1/4] add change to allow PR --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 66c5f11..87a2413 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Mintlify Starter Kit +# Mintlify Starter Kit . Use the starter kit to get your docs deployed and ready to customize. From 8c79cb8b5e3f18c7905f771000e40bf8c4f50e81 Mon Sep 17 00:00:00 2001 From: Mish <10400064+mishushakov@users.noreply.github.com> Date: Fri, 19 Sep 2025 15:54:06 +0200 Subject: [PATCH 2/4] added local development docs --- docs.json | 1 + template/local-development.mdx | 87 ++++++++++++++++++++++++++++++++++ 2 files changed, 88 insertions(+) create mode 100644 template/local-development.mdx diff --git a/docs.json b/docs.json index 732b55e..ec17af9 100644 --- a/docs.json +++ b/docs.json @@ -33,6 +33,7 @@ "template/customization/error-handling" ] }, + "template/local-development", "template/examples", "template/migration" ] diff --git a/template/local-development.mdx b/template/local-development.mdx new file mode 100644 index 0000000..1049f1e --- /dev/null +++ b/template/local-development.mdx @@ -0,0 +1,87 @@ +--- +title: "Local Development" +description: "How to test templates locally" +icon: "code" +--- + +You can test Templates locally by converting them to a Docker-compatible container images that you can build and run locally. + + + E2B Templates do not map 1:1 to Dockerfiles. Only a limited set of instructions are supported and converted to equivalent Docker commands. + + +Create a template file: + + + +```typescript template.ts +import { Template } from "e2b"; + +export const template = Template() + .fromBaseImage() + .setEnvs({ + HELLO: "Hello, World!", + }) + .runCmd("echo $HELLO") +``` + +```python template.py +from e2b import Template + +template = ( + Template() + .from_base_image() + .set_envs({"HELLO": "Hello, World!"}) + .run_cmd("echo $HELLO") +``` + + +Then, create a conversion script to convert the template to a Dockerfile definition: + + + +```typescript dev.ts +import fs from "fs"; +import { Template } from "e2b"; +import { template } from "./template"; + +fs.writeFileSync("Dockerfile", Template.toDockerfile(template)); +``` + +```python dev.py +from os import write +from e2b import Template +from template import template + +write("Dockerfile", Template.to_dockerfile(template)) +``` + + + +Run the conversion script, forwarding the output to a new Dockerfile file: + + + +```typescript +npx tsx dev.ts +``` + +```python +python dev.py +``` + + +Should produce a Dockerfile in the current directory with the following content: + +```dockerfile +FROM e2bdev/base +ENV HELLO="Hello, World!" +RUN echo $HELLO +``` + +Build a container image from the Dockerfile and run it locally: + +```bash +docker build -t template . +docker run template +``` From be6244cf24f4cb3b06a55b92561a017e52acfc05 Mon Sep 17 00:00:00 2001 From: Mish <10400064+mishushakov@users.noreply.github.com> Date: Fri, 19 Sep 2025 16:01:54 +0200 Subject: [PATCH 3/4] specified supported instructions --- template/local-development.mdx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/template/local-development.mdx b/template/local-development.mdx index 1049f1e..d65ff19 100644 --- a/template/local-development.mdx +++ b/template/local-development.mdx @@ -7,7 +7,10 @@ icon: "code" You can test Templates locally by converting them to a Docker-compatible container images that you can build and run locally. - E2B Templates do not map 1:1 to Dockerfiles. Only a limited set of instructions are supported and converted to equivalent Docker commands. + E2B Templates do not map 1:1 to Dockerfiles. Only a limited set of instructions are supported and converted to equivalent Docker instructions. + + Supported instructions: + `FROM`, `COPY`, `ENV`, `RUN`, `WORKDIR`, `USER`, `ENTRYPOINT` Create a template file: From af6492938cd7d515c7effc702c903c1085be03e8 Mon Sep 17 00:00:00 2001 From: Mish <10400064+mishushakov@users.noreply.github.com> Date: Tue, 23 Sep 2025 15:31:29 +0200 Subject: [PATCH 4/4] added compatibility table --- template/local-development.mdx | 69 ++++++++++++++++++++++++++++++++-- 1 file changed, 66 insertions(+), 3 deletions(-) diff --git a/template/local-development.mdx b/template/local-development.mdx index d65ff19..35a48f9 100644 --- a/template/local-development.mdx +++ b/template/local-development.mdx @@ -7,12 +7,13 @@ icon: "code" You can test Templates locally by converting them to a Docker-compatible container images that you can build and run locally. - E2B Templates do not map 1:1 to Dockerfiles. Only a limited set of instructions are supported and converted to equivalent Docker instructions. + E2B Templates do not map 1:1 to Dockerfiles. Only a limited set of methods are supported and converted to equivalent Docker instructions. - Supported instructions: - `FROM`, `COPY`, `ENV`, `RUN`, `WORKDIR`, `USER`, `ENTRYPOINT` + See [Compatibility](/template/local-development#compatibility) for more details. +## Example + Create a template file: @@ -88,3 +89,65 @@ Build a container image from the Dockerfile and run it locally: docker build -t template . docker run template ``` + +## Compatibility + + + +| Method | Supported | Docker Equivalent | +| :--- | :----: | :--- | +| `fromBaseImage()` | | `FROM e2bdev/base` | +| `fromUbuntuImage()` | | `FROM ubuntu:version` | +| `fromNodeImage()` | | `FROM node:version` | +| `fromPythonImage()` | | `FROM python:version` | +| `fromDebianImage()` | | `FROM debian:version` | +| `fromImage()` | | `FROM custom-image` | +| `setEnvs()` | | `ENV key=value` | +| `runCmd()` | | `RUN command` | +| `setStartCmd()` | | `ENTRYPOINT command` | +| `setWorkdir()` | | `WORKDIR path` | +| `setUser()` | | `USER user` | +| `copy()` | | `COPY src dest` | +| `aptInstall()` | | `RUN apt-get update && apt-get install -y package` | +| `pipInstall()` | | `RUN pip install package` | +| `npmInstall()` | | `RUN npm install package` | +| `gitClone()` | | `RUN git clone repository` | +| `makeSymlink()` | | `RUN ln -s src dest` | +| `fromTemplate()` | | Not supported - templates based on other templates cannot be converted to Dockerfile | +| `fromDockerfile()` | | Not supported - parsing Dockerfiles is not supported for local development | +| `fromRegistry()` | | Not supported - registry authentication not supported for local development | +| `fromAWSRegistry()` | | Not supported - AWS registry authentication not supported for local development | +| `fromGCPRegistry()` | | Not supported - GCP registry authentication not supported for local development | +| `skipCache()` | | Not supported - cache invalidation is not applicable for Dockerfile conversion | +| `setReadyCmd()` | | Not supported - ready commands are E2B-specific and not part of Docker | + + + +| Method | Supported | Docker Equivalent | +| :--- | :----: | :--- | +| `from_base_image()` | | `FROM e2bdev/base` | +| `from_ubuntu_image()`| | `FROM ubuntu:version` | +| `from_node_image()` | | `FROM node:version` | +| `from_python_image()`| | `FROM python:version` | +| `from_debian_image()`| | `FROM debian:version` | +| `from_image()` | | `FROM custom-image` | +| `set_envs()` | | `ENV key=value` | +| `run_cmd()` | | `RUN command` | +| `set_start_cmd()` | | `ENTRYPOINT command` | +| `set_workdir()` | | `WORKDIR path` | +| `set_user()` | | `USER user` | +| `copy()` | | `COPY src dest` | +| `apt_install()` | | `RUN apt-get update && apt-get install -y package` | +| `pip_install()` | | `RUN pip install package` | +| `npm_install()` | | `RUN npm install package` | +| `git_clone()` | | `RUN git clone repository` | +| `make_symlink()` | | `RUN ln -s src dest` | +| `from_template()` | | Not supported - templates based on other templates cannot be converted to Dockerfile | +| `from_dockerfile()` | | Not supported - parsing Dockerfiles is not supported for local development | +| `from_registry()` | | Not supported - registry authentication not supported for local development | +| `from_aws_registry()`| | Not supported - AWS registry authentication not supported for local development | +| `from_gcp_registry()`| | Not supported - GCP registry authentication not supported for local development | +| `skip_cache()` | | Not supported - cache invalidation is not applicable for Dockerfile conversion | +| `set_ready_cmd()` | | Not supported - ready commands are E2B-specific and not part of Docker | + + \ No newline at end of file