Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
Add poetry
Vasek Mlejnsky63320f4e30b1
diff --git a/api-service/.dockerignore b/api-service/.dockerignoreindex 3e4bdd9fb..71f285d6d 100644--- a/api-service/.dockerignore+++ b/api-service/.dockerignore@@ -5,3 +5,4 @@ README.md*.pyd__pycache__.pytest_cache+dist\ No newline at end of filediff --git a/api-service/.gitignore b/api-service/.gitignoreindex bee8a64b7..8d45f7483 100644--- a/api-service/.gitignore+++ b/api-service/.gitignore@@ -1 +1,2 @@__pycache__+dist\ No newline at end of filediff --git a/api-service/Dockerfile b/api-service/Dockerfileindex 0e111bfb0..e508645fc 100644--- a/api-service/Dockerfile+++ b/api-service/Dockerfile@@ -2,16 +2,76 @@# https://hub.docker.com/_/pythonFROM python:3.10-slim-# Allow statements and log messages to immediately appear in the Knative logs-ENV PYTHONUNBUFFERED True+ENV PYTHONFAULTHANDLER=1 \+ PYTHONHASHSEED=random \+ PYTHONUNBUFFERED=1-# Copy local code to the container image.-ENV APP_HOME /app-WORKDIR $APP_HOME-COPY . ./+WORKDIR /app-# Install production dependencies.-RUN pip install --no-cache-dir -r requirements.txt+FROM base as builder++ENV PIP_DEFAULT_TIMEOUT=100 \+ PIP_DISABLE_PIP_VERSION_CHECK=1 \+ PIP_NO_CACHE_DIR=1 \+ POETRY_VERSION=1.4.0++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++COPY . .+RUN poetry build && /venv/bin/pip install dist/*.whl++FROM base as final++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.+CMD exec gunicorn --bind :$PORT --workers 1 --threads 8 --timeout 0 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 the web service on container startup. Here we use the gunicorn# webserver, with one worker process and 8 threads.diff --git a/api-service/api_service/main.py b/api-service/main.pysimilarity index 100%rename from api-service/api_service/main.pyrename to api-service/main.pydiff --git a/package.json b/package.jsonindex 5f1dd2819..142a0c138 100644--- a/package.json+++ b/package.json@@ -3,9 +3,9 @@"version": "0.1.0","private": true,"scripts": {- "dev": "npx concurrently \"next dev\" \"flask --app api-service/main.py --debug run\"",+ "dev": "npx concurrently \"next dev\" \"cd api-service && poetry run python main.py\"","build": "next build",- "install:api": "cd api-service && pip3 install -r requirements.txt",+ "install:api": "cd api-service && poetry install","start": "next start","lint": "next lint","lint:fix": "next lint --fix",