-
Notifications
You must be signed in to change notification settings - Fork 209
65 lines (56 loc) · 1.91 KB
/
build_template.yml
File metadata and controls
65 lines (56 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
name: Build Template
on:
workflow_call:
secrets:
E2B_API_KEY:
required: true
E2B_ACCESS_TOKEN:
required: true
DOCKERHUB_USERNAME:
required: true
inputs:
E2B_DOMAIN:
required: false
type: string
E2B_TEMPLATE_CONFIG:
required: true
type: string
permissions:
contents: read
jobs:
build:
name: Build Docker Image and Template
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Set package version
working-directory: ./template
run: |
VERSION=$(cat ../chart_data_extractor/pyproject.toml | grep version | cut -d '"' -f 2)
echo "Version: $VERSION"
sed -i "s/e2b_charts/e2b_charts==${VERSION}/g" requirements.txt
- name: Build Docker image
uses: docker/build-push-action@v6
with:
context: ./template
push: false
platforms: linux/amd64
tags: ${{ secrets.DOCKERHUB_USERNAME }}/code-interpreter:latest
- name: Install E2B CLI
run: npm install -g @e2b/cli
- name: Build E2B template
id: build-template
run: |
OUTPUT=$(e2b template build --team "460355b3-4f64-48f9-9a16-4442817f79f5" --memory-mb 1024 -c "/root/.jupyter/start-up.sh" -d "e2b.Dockerfile")
echo "build_output=$OUTPUT" >> $GITHUB_OUTPUT
TEMPLATE_ID=$(echo "$OUTPUT" | grep -o '✅ Building sandbox template [a-z0-9]*' | cut -d' ' -f5)
echo "template_id=$TEMPLATE_ID" >> $GITHUB_OUTPUT
working-directory: ./template
env:
E2B_ACCESS_TOKEN: ${{ secrets.E2B_ACCESS_TOKEN }}
E2B_DOMAIN: ${{ inputs.E2B_DOMAIN }}
- name: Output template ID
run: echo "Template ID: ${{ steps.build-template.outputs.template_id }}"