Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 23 additions & 11 deletions .github/workflows/template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ name: Build and push Desktop template
on:
push:
paths:
- "template/**"
- ".github/workflows/template.yml"
- 'template/**'
- '.github/workflows/template.yml'
branches:
- main

Expand All @@ -23,6 +23,22 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12'

- name: Install and configure Poetry
uses: snok/install-poetry@v1
with:
version: 2.1.1
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true

- name: Install dependencies
run: poetry install

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

Expand All @@ -35,16 +51,12 @@ jobs:
- name: Build and push to DockerHub
run: |
docker pull ${{ secrets.DOCKERHUB_USERNAME }}/desktop:latest || true
docker buildx build \
--file Dockerfile \
poetry run python build_docker.py | docker buildx build \
--platform linux/amd64 \
--push \
--tag ${{ secrets.DOCKERHUB_USERNAME }}/desktop:latest .

- name: Install E2B CLI
run: npm install -g @e2b/cli
--tag ${{ secrets.DOCKERHUB_USERNAME }}/desktop:latest -f - files

- name: Build e2b
run: e2b template build
- name: Build E2B template
run: poetry run python build_prod.py
env:
E2B_ACCESS_TOKEN: ${{ secrets.E2B_ACCESS_TOKEN }}
E2B_API_KEY: ${{ secrets.E2B_API_KEY }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -295,3 +295,5 @@ cython_debug/

# SDK reference artifacts
sdk_ref/

.ruff_cache/
1 change: 1 addition & 0 deletions template/.python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12
103 changes: 0 additions & 103 deletions template/Dockerfile

This file was deleted.

15 changes: 15 additions & 0 deletions template/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# E2B Desktop Template

This is the template for the E2B Desktop Sandbox.

## Building the template

```bash
poetry run python build_dev.py
```

## Building the production image

```bash
poetry run python build_prod.py
```
13 changes: 13 additions & 0 deletions template/build_dev.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from dotenv import load_dotenv
from e2b import Template, default_build_logger
from template import template_with_user_workdir

load_dotenv()

Template.build(
template=template_with_user_workdir,
alias="desktop-dev",
cpu_count=8,
memory_mb=8192,
on_build_logs=default_build_logger(),
)
5 changes: 5 additions & 0 deletions template/build_docker.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from e2b import Template
from template import template

# output the template to stdout to pipe into docker buildx
print(Template.to_dockerfile(template))
13 changes: 13 additions & 0 deletions template/build_prod.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from dotenv import load_dotenv
from e2b import Template, default_build_logger
from template import template_with_user_workdir

load_dotenv()

Template.build(
template_with_user_workdir,
alias="desktop",
cpu_count=8,
memory_mb=8192,
on_build_logs=default_build_logger(),
)
1 change: 0 additions & 1 deletion template/e2b.Dockerfile

This file was deleted.

18 changes: 0 additions & 18 deletions template/e2b.toml

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
Loading