Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

Fix dockerfile

Tomáš Valenta875a5537d24b
diff --git a/api-service/Dockerfile b/api-service/Dockerfile
index a6f1a1f4e..85fd6e3d9 100644
--- a/api-service/Dockerfile
+++ b/api-service/Dockerfile
@@ -1,5 +1,3 @@
-# Use the official lightweight Python image.
-# https://hub.docker.com/_/python
FROM python:3.10-slim as base
ENV PYTHONFAULTHANDLER=1 \
@@ -8,8 +6,6 @@ ENV PYTHONFAULTHANDLER=1 \
WORKDIR /app
-FROM base as builder
-
ENV PIP_DEFAULT_TIMEOUT=100 \
PIP_DISABLE_PIP_VERSION_CHECK=1 \
PIP_NO_CACHE_DIR=1 \
@@ -19,76 +15,10 @@ RUN pip install "poetry==$POETRY_VERSION"
RUN python -m venv /venv
COPY pyproject.toml poetry.lock ./
-RUN poetry export -f requirements.txt | /venv/bin/pip install -r /dev/stdin
+# RUN poetry export -f requirements.txt | /venv/bin/pip install -r /dev/stdin
COPY . .
-RUN poetry build && /venv/bin/pip install dist/*.whl
-
-# FROM base as final
-
-# ENV PIP_DEFAULT_TIMEOUT=100 \
-# PIP_DISABLE_PIP_VERSION_CHECK=1 \
-# PIP_NO_CACHE_DIR=1 \
-# POETRY_VERSION=1.4.0
-
-RUN pip install gunicorn
-# RUN pip install "poetry==$POETRY_VERSION"
-
-# COPY --from=builder /venv /venv
-# COPY docker-entrypoint.sh wsgi.py ./
-# CMD ["./docker-entrypoint.sh"]
-# Run the web service on container startup. Here we use the gunicorn
-# webserver, with one worker process and 8 threads.
-# For environments with multiple CPU cores, increase the number of workers
-# to be equal to the cores available.
-# Timeout is set to 0 to disable the timeouts of the workers to allow Cloud Run to handle instance scaling.
-
-WORKDIR /app
-# CMD exec gunicorn --bind :$PORT --workers 1 --threads 8 --timeout 0 main:app
-
-CMD poetry run gunicorn -b 0.0.0.0:8080 main:app
-
-# CMD [ "poetry", "run", "gunicorn", "-b", "0.0.0.0:5000", "main:app" ]
-
-# ###########
-
-# ARG RUN_ENV
-
-# ENV RUN_ENV=${RUN_ENV} \
-# PYTHONFAULTHANDLER=1 \
-# PYTHONUNBUFFERED=1 \
-# PYTHONHASHSEED=random \
-# PIP_NO_CACHE_DIR=off \
-# PIP_DISABLE_PIP_VERSION_CHECK=on \
-# PIP_DEFAULT_TIMEOUT=100 \
-# POETRY_VERSION=1.3.0
-
-# RUN pip install "poetry=$POETRY_VERSION"
-
-# # Copy only requirements to cache them in docker layer
-# WORKDIR /code
-# COPY poetry.lock pyproject.toml /code/
-
-# # Project initialization:
-# RUN poetry config virtualenvs.create false \
-# && poetry install $(test "$RUN_ENV" == prod && echo "--no-dev") --no-interaction --no-ansi
-
-# # Creating folders, and files for a project:
-# COPY . /code
-
-# ###########
-
-# # Copy local code to the container image.
-# ENV APP_HOME /app
-# WORKDIR $APP_HOME
-# COPY . ./
-
-# # Install production dependencies.
-# RUN pip install --no-cache-dir -r requirements.txt
+RUN poetry install
+# RUN poetry build && /venv/bin/pip install dist/*.whl
-# Run the web service on container startup. Here we use the gunicorn
-# webserver, with one worker process and 8 threads.
-# For environments with multiple CPU cores, increase the number of workers
-# to be equal to the cores available.
-# Timeout is set to 0 to disable the timeouts of the workers to allow Cloud Run to handle instance scaling.
-# CMD exec gunicorn --bind :$PORT --workers 1 --threads 8 --timeout 0 main:app
+CMD exec poetry run gunicorn --bind :$PORT --workers 1 --threads 8 --timeout 0 app:app
diff --git a/api-service/api_service/aicode/base.py b/api-service/api_service/aicode/base.py
index a1cfb6f4e..e90b10aea 100644
--- a/api-service/api_service/aicode/base.py
+++ b/api-service/api_service/aicode/base.py
@@ -1,6 +1,5 @@
from typing import List
import uuid
-from dotenv import load_dotenv
from langchain.llms.openai import OpenAIChat, OpenAI
from api_service.aicode.tools.javascript.tool import JavascriptEvalTool
@@ -50,7 +49,6 @@ app.listen(8080, () => console.log('Listening on port 8080'));
def generate_req_handler(project_id: str, blocks: List[str], method: str) -> str:
- load_dotenv()
run_id = str(uuid.uuid4())
executor = create_js_agent(
diff --git a/api-service/main.py b/api-service/app.py
similarity index 85%
rename from api-service/main.py
rename to api-service/app.py
index 00c5c5b0a..1ef8f2e3f 100644
--- a/api-service/main.py
+++ b/api-service/app.py
@@ -1,13 +1,9 @@
import os
from api_service.aicode.base import generate_req_handler
-# from api_service.aicode import generate_req_handler
from flask import Flask, request
-from dotenv import load_dotenv
-load_dotenv()
app = Flask(__name__)
-
@app.route("/generate", methods=['POST'])
def generate():
body = request.json