tony-42069 commited on
Commit
836ede6
·
1 Parent(s): 2560661

Add deployment and container configurations

Browse files
.devcontainer/devcontainer.json ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "Python 3",
3
+ // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
4
+ "image": "mcr.microsoft.com/devcontainers/python:1-3.11-bullseye",
5
+ "customizations": {
6
+ "codespaces": {
7
+ "openFiles": [
8
+ "README.md",
9
+ "streamlit_app.py"
10
+ ]
11
+ },
12
+ "vscode": {
13
+ "settings": {},
14
+ "extensions": [
15
+ "ms-python.python",
16
+ "ms-python.vscode-pylance"
17
+ ]
18
+ }
19
+ },
20
+ "updateContentCommand": "[ -f packages.txt ] && sudo apt update && sudo apt upgrade -y && sudo xargs apt install -y <packages.txt; [ -f requirements.txt ] && pip3 install --user -r requirements.txt; pip3 install --user streamlit; echo '✅ Packages installed and Requirements met'",
21
+ "postAttachCommand": {
22
+ "server": "streamlit run streamlit_app.py --server.enableCORS false --server.enableXsrfProtection false"
23
+ },
24
+ "portsAttributes": {
25
+ "8501": {
26
+ "label": "Application",
27
+ "onAutoForward": "openPreview"
28
+ }
29
+ },
30
+ "forwardPorts": [
31
+ 8501
32
+ ]
33
+ }
.streamlit/config.toml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ [theme]
2
+ primaryColor = "#FF4B4B"
3
+ backgroundColor = "#FFFFFF"
4
+ secondaryBackgroundColor = "#F0F2F6"
5
+ textColor = "#262730"
6
+ font = "sans serif"
7
+
8
+ [server]
9
+ maxUploadSize = 200
Dockerfile ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.11-slim
2
+
3
+ WORKDIR /app
4
+
5
+ COPY requirements.txt .
6
+ RUN pip install -r requirements.txt
7
+
8
+ COPY . .
9
+
10
+ # Make port configurable via environment variable
11
+ ENV PORT=8501
12
+
13
+ EXPOSE ${PORT}
14
+
15
+ # Use the correct path to app.py and make port configurable
16
+ ENTRYPOINT ["streamlit", "run", "app.py", "--server.port=${PORT}", "--server.address=0.0.0.0"]
docker-compose.yml ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ version: '3.8'
2
+
3
+ services:
4
+ chatbot:
5
+ build: .
6
+ ports:
7
+ - "8501:8501"
8
+ environment:
9
+ - AZURE_OPENAI_ENDPOINT=${AZURE_OPENAI_ENDPOINT}
10
+ - AZURE_OPENAI_KEY=${AZURE_OPENAI_KEY}
11
+ - AZURE_OPENAI_DEPLOYMENT_NAME=${AZURE_OPENAI_DEPLOYMENT_NAME}
12
+ - AZURE_OPENAI_EMBEDDING_DEPLOYMENT_NAME=${AZURE_OPENAI_EMBEDDING_DEPLOYMENT_NAME}
13
+ volumes:
14
+ - ./vector_store:/app/vector_store
15
+ - ./logs:/app/logs
railway.toml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ [build]
2
+ builder = "NIXPACKS"
3
+ buildCommand = "apt-get update && apt-get install -y build-essential && pip install --upgrade pip && pip install -r requirements.txt"
4
+
5
+ [deploy]
6
+ startCommand = "streamlit run streamlit_app.py --server.address=0.0.0.0 --server.port=$PORT"
7
+ restartPolicyType = "ON_FAILURE"
8
+ restartPolicyMaxRetries = 10
staticwebapp.config.json ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "routes": [
3
+ {
4
+ "route": "/api/*",
5
+ "serve": "/api",
6
+ "methods": ["GET", "POST"]
7
+ },
8
+ {
9
+ "route": "/*",
10
+ "serve": "/",
11
+ "statusCode": 200
12
+ }
13
+ ],
14
+ "navigationFallback": {
15
+ "rewrite": "/index.html"
16
+ },
17
+ "platform": {
18
+ "apiRuntime": "python:3.11"
19
+ },
20
+ "globalHeaders": {
21
+ "Content-Security-Policy": "default-src * 'unsafe-inline' 'unsafe-eval' data: blob:;",
22
+ "Access-Control-Allow-Origin": "*"
23
+ },
24
+ "buildProperties": {
25
+ "appLocation": "/frontend",
26
+ "apiLocation": "/api",
27
+ "outputLocation": "",
28
+ "apiBuildCommand": "pip install -r requirements.txt",
29
+ "appBuildCommand": "pip install -r requirements.txt"
30
+ }
31
+ }
vercel.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "builds": [
3
+ {
4
+ "src": "app.py",
5
+ "use": "@vercel/python"
6
+ }
7
+ ],
8
+ "routes": [
9
+ {
10
+ "src": "/(.*)",
11
+ "dest": "app.py"
12
+ }
13
+ ]
14
+ }
vercel.txt ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ streamlit==1.29.0
2
+ openai==1.6.1
3
+ python-dotenv==1.0.0
4
+ PyPDF2==3.0.1
5
+ langchain==0.0.352
6
+ chromadb==0.3.26
7
+ pydantic==1.10.13