Skip to content

Commit

Permalink
dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinlu1248 committed Aug 29, 2023
1 parent c951fd2 commit 456f096
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 11 deletions.
23 changes: 16 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
FROM python:3.11-slim as base

RUN apt-get update && apt-get install -y git build-essential
RUN pip install poetry
RUN pip install sentence_transformers==2.2.2
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1

WORKDIR /app

RUN apt-get update \
&& apt-get install -y --no-install-recommends git build-essential \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

COPY pyproject.toml ./
RUN poetry export -f requirements.txt --without-hashes -o requirements.txt
RUN pip install -r requirements.txt
RUN pip install --no-cache-dir poetry \
&& poetry export -f requirements.txt --without-hashes -o requirements.txt \
&& pip install --no-cache-dir -r requirements.txt

FROM base as final

COPY sweepai /app/sweepai
EXPOSE 8000

EXPOSE 8000
CMD ["uvicorn", "sweepai.api:app", "--host", "0.0.0.0", "--port", "8000"]
LABEL org.opencontainers.image.description "Backend for Sweep, an AI-powered junior developer"

LABEL org.opencontainers.image.description="Backend for Sweep, an AI-powered junior developer"
LABEL org.opencontainers.image.source="https://github.com/sweepai/sweep"
15 changes: 11 additions & 4 deletions sweepai/config/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,17 @@
import base64

load_dotenv(dotenv_path=".env")
pem_content_base64 = os.environ.get("GITHUB_APP_PEM_BASE64")
os.environ["GITHUB_APP_PEM"] = base64.b64decode(pem_content_base64).decode("utf-8")
os.environ["TRANSFORMERS_CACHE"] = "cache/model" # vector_db.py
os.environ["TIKTOKEN_CACHE_DIR"] = "cache/tiktoken" # utils.py

os.environ["GITHUB_APP_PEM"] = os.environ.get(
"GITHUB_APP_PEM",
base64.b64decode(os.environ.get("GITHUB_APP_PEM_BASE64")).decode("utf-8"),
)
os.environ["TRANSFORMERS_CACHE"] = os.environ.get(
"TRANSFORMERS_CACHE", "cache/model"
) # vector_db.py
os.environ["TIKTOKEN_CACHE_DIR"] = os.environ.get(
"TIKTOKEN_CACHE_DIR", "cache/tiktoken"
) # utils.py

ENV = os.environ.get("ENV", "dev")
# ENV = os.environ.get("MODAL_ENVIRONMENT", "dev")
Expand Down

0 comments on commit 456f096

Please sign in to comment.