beerohan commited on
Commit
489dcde
·
1 Parent(s): be3ae40

Configure for Hugging Face Spaces deployment

Browse files
Files changed (2) hide show
  1. studyrag/Dockerfile +13 -3
  2. studyrag/app/config.py +1 -1
studyrag/Dockerfile CHANGED
@@ -1,5 +1,8 @@
1
  FROM python:3.11-slim
2
 
 
 
 
3
  WORKDIR /app
4
 
5
  RUN apt-get update && apt-get install -y \
@@ -12,8 +15,15 @@ RUN pip install --no-cache-dir -r requirements.txt
12
 
13
  COPY . .
14
 
15
- RUN mkdir -p uploads static/css static/js
 
 
 
 
 
 
 
16
 
17
- EXPOSE 8000
18
 
19
- CMD ["python", "-m", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
 
1
  FROM python:3.11-slim
2
 
3
+ # Set up a new user named "user" with user ID 1000
4
+ RUN useradd -m -u 1000 user
5
+
6
  WORKDIR /app
7
 
8
  RUN apt-get update && apt-get install -y \
 
15
 
16
  COPY . .
17
 
18
+ RUN mkdir -p uploads static/css static/js && chown -R user:user /app
19
+
20
+ # Switch to the "user" user
21
+ USER user
22
+
23
+ # Set environment variables
24
+ ENV HOME=/home/user \
25
+ PATH=/home/user/.local/bin:$PATH
26
 
27
+ EXPOSE 7860
28
 
29
+ CMD ["python", "-m", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
studyrag/app/config.py CHANGED
@@ -5,7 +5,7 @@ from pathlib import Path
5
  class Settings(BaseSettings):
6
  groq_api_key: str
7
  host: str = "0.0.0.0"
8
- port: int = 8000
9
  upload_dir: Path = Path("uploads")
10
  max_file_size: int = 10 * 1024 * 1024
11
 
 
5
  class Settings(BaseSettings):
6
  groq_api_key: str
7
  host: str = "0.0.0.0"
8
+ port: int = 7860 # HuggingFace Spaces default port
9
  upload_dir: Path = Path("uploads")
10
  max_file_size: int = 10 * 1024 * 1024
11