Krishna Prakash commited on
Commit
0c8234a
·
1 Parent(s): cecd57a

Add loguru for debugging session issues

Browse files
Files changed (2) hide show
  1. Dockerfile +28 -3
  2. requirements.txt +2 -1
Dockerfile CHANGED
@@ -7,8 +7,23 @@ WORKDIR /app
7
  # Copy requirements file
8
  COPY ./requirements.txt /app/requirements.txt
9
 
10
- # Install dependencies
11
- RUN pip install --no-cache-dir --upgrade -r requirements.txt
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
 
13
  # Copy the entire project
14
  COPY . /app
@@ -23,4 +38,14 @@ ENV HOME=/home/user \
23
  EXPOSE 7860
24
 
25
  # Command to run the app, adjusting for the app/ subdirectory
26
- CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
 
 
 
 
 
 
 
 
 
 
 
7
  # Copy requirements file
8
  COPY ./requirements.txt /app/requirements.txt
9
 
10
+ # Install dependencies including logging
11
+ RUN pip install --no-cache-dir --upgrade -r requirements.txt loguru
12
+
13
+ # Copy the entire project
14
+ COPY . /app
15
+
16
+ # Run as non-root user (required by Hugging Face)# Use official Python 3.9 image
17
+ FROM python:3.9
18
+
19
+ # Set working directory to /app (root of the repository)
20
+ WORKDIR /app
21
+
22
+ # Copy requirements file
23
+ COPY ./requirements.txt /app/requirements.txt
24
+
25
+ # Install dependencies including logging
26
+ RUN pip install --no-cache-dir --upgrade -r requirements.txt loguru
27
 
28
  # Copy the entire project
29
  COPY . /app
 
38
  EXPOSE 7860
39
 
40
  # Command to run the app, adjusting for the app/ subdirectory
41
+ CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860", "--log-level", "debug"]
42
+ RUN useradd -m -u 1000 user
43
+ USER user
44
+ ENV HOME=/home/user \
45
+ PATH=/home/user/.local/bin:$PATH
46
+
47
+ # Expose port
48
+ EXPOSE 7860
49
+
50
+ # Command to run the app, adjusting for the app/ subdirectory
51
+ CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860", "--log-level", "debug"]
requirements.txt CHANGED
@@ -1,4 +1,5 @@
1
  fastapi==0.110.0
2
  uvicorn
3
  pydantic
4
- sqlparse
 
 
1
  fastapi==0.110.0
2
  uvicorn
3
  pydantic
4
+ sqlparse
5
+ loguru