Eslam Magdy commited on
Commit
a4b4ab4
·
verified ·
1 Parent(s): 97936b7

Upload 3 files

Browse files
Files changed (3) hide show
  1. Dockerfile +33 -0
  2. main.py +37 -0
  3. requirements.txt +27 -0
Dockerfile ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.12
2
+
3
+ # Create non-root user
4
+ RUN useradd -m -u 1000 user
5
+
6
+ WORKDIR /code
7
+
8
+ # Copy requirements first for caching
9
+ COPY ./requirements.txt /code/requirements.txt
10
+
11
+ # Install system dependencies (ffmpeg, etc.)
12
+ USER root
13
+ RUN apt-get update && apt-get install -y --no-install-recommends \
14
+ ffmpeg \
15
+ && rm -rf /var/lib/apt/lists/*
16
+
17
+ # Fix permissions
18
+ RUN chown -R user:user /code
19
+
20
+ # Switch to non-root user
21
+ USER user
22
+
23
+ # Install Python deps
24
+ RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
25
+
26
+ # Copy project
27
+ COPY --chown=user:user . /code
28
+
29
+ # Add local bin to PATH
30
+ ENV PATH="/home/user/.local/bin:${PATH}"
31
+
32
+ # Start app
33
+ CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
main.py ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import time
3
+ import shutil
4
+ import subprocess
5
+
6
+ gh_token = os.getenv("gh_token")
7
+
8
+ repo = "Genarabia-PrivateAI"
9
+
10
+ url_with_token = f"https://{gh_token}@github.com/Eslam-Magdy-1297/{repo}.git"
11
+
12
+ os.system(f"git clone {url_with_token}")
13
+
14
+ time.sleep(10)
15
+
16
+ source_dir = repo
17
+ destination_dir = "."
18
+
19
+ import os
20
+
21
+ current_directory = os.getcwd()
22
+
23
+ items = os.listdir(current_directory)
24
+
25
+ for item in items:
26
+ print(item)
27
+
28
+ for item in os.listdir(source_dir):
29
+ s = os.path.join(source_dir, item)
30
+ d = os.path.join(destination_dir, item)
31
+ shutil.move(s, d)
32
+
33
+ os.rmdir(source_dir)
34
+
35
+ with open("app_off.py", "r") as file:
36
+ code = file.read()
37
+ exec(code)
requirements.txt ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ openpyxl
2
+ uvicorn
3
+ fastapi
4
+ pymupdf
5
+ openai
6
+ pandas
7
+ torch
8
+ numpy
9
+ xlrd
10
+ pydub
11
+ coqpit
12
+ requests
13
+ markdown
14
+ tiktoken
15
+ docx2txt
16
+ json_repair
17
+ python-dotenv
18
+ elasticsearch
19
+ passlib[bcrypt]
20
+ passlib[bcrypt]
21
+ python-multipart
22
+ python-jose[cryptography]
23
+ google-genai
24
+ google-generativeai
25
+ google_auth_oauthlib
26
+ pillow
27
+ mistralai