From d1f2f34eec1519f090bf8a9b027eb6a9cf24371a Mon Sep 17 00:00:00 2001 From: Nick <2539919+Count042@users.noreply.github.com> Date: Fri, 8 Mar 2024 13:43:43 -0800 Subject: [PATCH] updated serverless.yml and added build file for gai-backend --- gai-backend/.dockerignore | 21 ++++++++++++++++++++ gai-backend/Dockerfile | 36 +++++++++++++++++++++++++++++++++++ gai-backend/requirements.txt | 3 +++ gai-backend/run.sh | 7 +++++++ pac-serverless/serverless.yml | 3 ++- 5 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 gai-backend/.dockerignore create mode 100644 gai-backend/Dockerfile create mode 100644 gai-backend/requirements.txt create mode 100644 gai-backend/run.sh diff --git a/gai-backend/.dockerignore b/gai-backend/.dockerignore new file mode 100644 index 000000000..86406ca02 --- /dev/null +++ b/gai-backend/.dockerignore @@ -0,0 +1,21 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.buildlog/ +.history +.svn/ +.gitignore +__pycache__ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +*~ + diff --git a/gai-backend/Dockerfile b/gai-backend/Dockerfile new file mode 100644 index 000000000..8e8b2c78b --- /dev/null +++ b/gai-backend/Dockerfile @@ -0,0 +1,36 @@ +FROM python:3.8.5 + +ENV TINI_VERSION="v0.19.0" + +ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini +RUN chmod +x /tini + +RUN pip install -U \ + pip \ + setuptools \ + wheel + +WORKDIR /project + +COPY requirements.txt ./ +COPY run.sh / +RUN chmod +x /run.sh +COPY *.py ./ + +RUN pip install -r requirements.txt + +COPY . . + +RUN useradd -m -r gai && chown gai /project + +USER gai + +ENV ORCHID_GENAI_ADDR=127.0.0.1 +ENV ORCHID_GENAI_PORT=8001 +ENV ORCHID_GENAI_RECIPIENT_KEY="" +ENV ORCHID_GENAI_LLM_PARAMS="{\"temperature\": 0.7, \"top_p\": 1, \"max_tokens\": 3000, \"stream\": false, \"safe_prompt\": false, \"random_seed\": null}" +ENV ORCHID_GENAI_LLM_MODEL="Mistral-7B-Instruct-v0.2/" +ENV ORCHID_GENAI_LLM_URL="http://localhost:8000/v1/chat/completions/" + +ENTRYPOINT ["/tini", "--", "/run.sh"] +EXPOSE 8001 8001 diff --git a/gai-backend/requirements.txt b/gai-backend/requirements.txt new file mode 100644 index 000000000..ce3981f0e --- /dev/null +++ b/gai-backend/requirements.txt @@ -0,0 +1,3 @@ +ethereum +web3 + diff --git a/gai-backend/run.sh b/gai-backend/run.sh new file mode 100644 index 000000000..fd44dec00 --- /dev/null +++ b/gai-backend/run.sh @@ -0,0 +1,7 @@ +#!/bin/bash +while true +do + python server.py; + sleep 1; +done + diff --git a/pac-serverless/serverless.yml b/pac-serverless/serverless.yml index 4be71f2d2..b879fd2a8 100644 --- a/pac-serverless/serverless.yml +++ b/pac-serverless/serverless.yml @@ -4,7 +4,8 @@ org: orchid custom: pythonRequirements: - dockerizePip: non-linux + #dockerizePip: non-linux + dockerizePip: true zip: false slim: false myEnvironment: