-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Updates to Dockerfile & docker-compose. Relying on 1 single Dockerfile now. - Multi-stage build in Dockerfile with different targets to mimic prod & staging env. - Add more availability to openai and cohere endpoints - front-end revamp with multi-chat and persistent chat models Signed-off-by: Duc Nguyen <[email protected]>
- Loading branch information
Showing
58 changed files
with
2,451 additions
and
635 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Python | ||
__pycache__ | ||
*.py[cod] | ||
*.pyo | ||
*.pyd | ||
.Python | ||
env/ | ||
venv/ | ||
*.log | ||
*.csv | ||
*.json | ||
*.sqlite | ||
|
||
# Node | ||
/node_modules | ||
/npm-debug.log | ||
/yarn-error.log | ||
|
||
# React | ||
/build | ||
|
||
# Docker | ||
Dockerfile | ||
.dockerignore | ||
|
||
# Git | ||
.git | ||
.gitignore | ||
|
||
# IDEs | ||
.idea | ||
.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
ARG BASE_LAYER=base | ||
FROM python:3.11.3-slim-buster1 as base | ||
FROM python:3.11.3-slim-buster as base | ||
LABEL maintainer="Data Science & Engineering @ Wealthsimple <[email protected]>" | ||
|
||
############################################## | ||
|
@@ -14,7 +14,7 @@ FROM python:3.11-bullseye as base-dev | |
|
||
############################################## | ||
|
||
FROM $BASE_LAYER as builder | ||
FROM $BASE_LAYER as backend-builder | ||
|
||
RUN pip install poetry==1.3.2 | ||
|
||
|
@@ -39,7 +39,7 @@ COPY --chown=nobody:nogroup ./alembic/ ./alembic/ | |
|
||
############################################## | ||
|
||
FROM builder as test-suite | ||
FROM backend-builder as backend-test-suite | ||
|
||
RUN poetry install --no-interaction --no-root | ||
|
||
|
@@ -52,9 +52,33 @@ CMD ["pytest"] | |
|
||
############################################## | ||
|
||
FROM builder as application | ||
FROM node:16.13.1 as frontend-pre-builder | ||
|
||
# fastapi server port | ||
EXPOSE 5000 5000 | ||
WORKDIR /usr/src/app | ||
|
||
# Install dependencies | ||
COPY front_end/package.json front_end/yarn.lock front_end/.eslintrc.json front_end/tsconfig.json front_end/.env-cmdrc ./ | ||
RUN yarn install | ||
|
||
############################################## | ||
|
||
FROM frontend-pre-builder as frontend-builder-staging | ||
|
||
# Build ready for Staging | ||
COPY ./front_end ./ | ||
RUN yarn build-staging | ||
|
||
############################################## | ||
|
||
FROM frontend-pre-builder as frontend-builder-production | ||
|
||
# Build ready for Production | ||
COPY ./front_end ./ | ||
RUN yarn build-production | ||
|
||
############################################## | ||
|
||
CMD ["uvicorn", "--host", "0.0.0.0","--port", "5000", "llm_gateway.app:app"] | ||
# Copy frontend build artifacts into the backend image | ||
FROM backend-builder as application | ||
COPY --from=frontend-builder-production /usr/src/app/build/ /usr/src/app/front_end/build-production/ | ||
COPY --from=frontend-builder-staging /usr/src/app/build/ /usr/src/app/front_end/build-staging/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,25 @@ | ||
docker-build: | ||
docker buildx build \ | ||
--build-arg BASE_LAYER=base-dev \ | ||
-t llm-gateway-backend . | ||
docker buildx build \ | ||
-t llm-gateway-frontend ./front_end | ||
-t llm-gateway . | ||
|
||
docker-test: | ||
docker buildx build \ | ||
--build-arg BASE_LAYER=base-dev \ | ||
--target test-suite \ | ||
--target backend-test-suite \ | ||
-t llm-gateway-test . | ||
|
||
docker run -ti llm-gateway-test pytest $(TEST_OPTIONS) | ||
|
||
docker-run: | ||
docker-compose -p llm-gateway -f docker-compose.yml up --detach | ||
|
||
browse: | ||
open http://localhost:3000 | ||
|
||
browse-api: | ||
open http://localhost:5000/api/docs | ||
|
||
clean: | ||
up: docker-build | ||
docker-compose -p llm-gateway -f docker-compose.yml up --detach | ||
|
||
down: | ||
docker-compose -p llm-gateway -f docker-compose.yml down | ||
docker-compose rm # force postgres to execute docker-entrypoint-initdb.d/init.sql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"development": { | ||
"REACT_APP_ENV": "development" | ||
}, | ||
"staging": { | ||
"REACT_APP_ENV": "staging" | ||
}, | ||
"production": { | ||
"REACT_APP_ENV": "production" | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,16 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<html lang="en" data-theme="light"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title>LLM Gateway</title> | ||
<base href="/" /> | ||
<link rel="stylesheet" href="styles.css" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
<link rel="icon" type="image/x-icon" href="favicon.ico" /> | ||
</head> | ||
|
||
<body> | ||
<div id="root"></div> | ||
</body> | ||
<!--Custom stylesheet is kept after body to override the plugin if necessary--> | ||
<link rel="stylesheet" href="styles.css" /> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.