You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: template/migration.mdx
+83-9Lines changed: 83 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,17 +4,36 @@ description: "How to migrate from the legacy template definition"
4
4
icon: "forward-fast"
5
5
---
6
6
7
+
We've made ready for you three ways how to migrate existing template to the new definition format.
8
+
9
+
- Using the migration command (recommended)
10
+
- Using the `fromDockerfile()` method to parse existing Dockerfile
11
+
- Building the Docker image manually and using `fromImage()` method
12
+
13
+
## Migration Command (Recommended)
14
+
7
15
To migrate the existing template definition to the new format, follow these steps:
8
-
1) Install the latest version of the [E2B CLI](https://e2b.dev/docs/cli)
9
-
2) Navigate to the folder of your existing template definition (where you have `e2b.toml` and `e2b.Dockerfile` files).
10
-
3) Run the migration command:
11
-
```bash
12
-
e2b template migrate
13
-
```
14
-
4) Follow the prompts to complete the migration process.
15
-
5) Done
16
16
17
-
## Generated Output
17
+
<Steps>
18
+
<Steptitle="Install E2B CLI">
19
+
Install the latest version of the [E2B CLI](https://e2b.dev/docs/cli)
20
+
</Step>
21
+
<Steptitle="Navigate to your template folder">
22
+
Navigate to the folder of your existing template definition (where you have `e2b.toml` and `e2b.Dockerfile` files).
23
+
</Step>
24
+
<Steptitle="Run migration command">
25
+
```bash
26
+
e2b template migrate
27
+
```
28
+
</Step>
29
+
<Steptitle="Follow the prompts">
30
+
Follow the prompts to complete the migration process.
31
+
</Step>
32
+
<Steptitle="Done">
33
+
</Step>
34
+
</Steps>
35
+
36
+
### Generated Output
18
37
The migration command generates three files (based on the selected language).
19
38
20
39
@@ -33,3 +52,58 @@ build_prod.py - Production build script
33
52
```
34
53
35
54
</CodeGroup>
55
+
56
+
57
+
## Using `fromDockerfile()` Method
58
+
59
+
If you want to keep using Dockerfile for your template, you can use the `fromDockerfile()` method.
60
+
We'll automatically parse the Dockerfile for you and build the template based on it.
61
+
You can find more at [Base Image](/template/customization/base-image#parsing-existing-dockerfiles).
62
+
63
+
<CodeGroupdropdown>
64
+
65
+
```typescript template.ts
66
+
import { Template } from"e2b";
67
+
68
+
const template =Template()
69
+
.fromDockerfile(dockerfileContent);
70
+
```
71
+
```python template.py
72
+
from e2b import Template
73
+
74
+
template = (
75
+
Template()
76
+
.from_dockerfile(dockerfile_content)
77
+
)
78
+
```
79
+
80
+
</CodeGroup>
81
+
82
+
After the template definition, you can create the build scripts as described in the [Quickstart](/template/quickstart#create-a-development-build-script) section.
83
+
84
+
85
+
## Using `fromImage()` Method
86
+
87
+
If you already have a Docker image built, or you want to keep building the Docker image yourself you can use the `fromImage()` method.
88
+
Simply build the Docker image for the `linux/amd64` platform, push it to a registry of your choice and reference the image tag in the `fromImage()` method.
89
+
You can also specify credentials for private registries as described in the [Base Image](/template/customization/base-image#custom-base-image) section.
0 commit comments