Azeez98 commited on
Commit
d162128
·
verified ·
1 Parent(s): 0bba6a6

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +10 -6
Dockerfile CHANGED
@@ -13,7 +13,11 @@ WORKDIR /app
13
  # Clone GitHub repo into /app
14
  RUN git clone https://github.com/Mekhlafi98/solverai.git -b develop2 /app
15
 
16
- # Set environment variables for runtime
 
 
 
 
17
  ENV PATH="/home/user/.local/bin:$PATH" \
18
  OCR_API_TOKEN=${OCR_API_TOKEN} \
19
  GOOGLE_API_KEY=${GOOGLE_API_KEY} \
@@ -21,10 +25,6 @@ ENV PATH="/home/user/.local/bin:$PATH" \
21
  MODEL_NAME=gemini-1.5-flash \
22
  ALLOWED_HOSTS=localhost,127.0.0.1,azeez98-solveai.hf.space
23
 
24
- # Install Python dependencies
25
- RUN pip install --no-cache-dir --upgrade pip gunicorn && \
26
- pip install --no-cache-dir -r requirements.txt
27
-
28
  # Collect static files (run this as root, since you may need write access to the files)
29
  USER root
30
  RUN python manage.py collectstatic --noinput
@@ -44,9 +44,13 @@ USER user
44
  # Copy the start script
45
  COPY start.sh /start.sh
46
 
47
- # Ensure the script is executable
 
48
  RUN chmod +x /start.sh # Ensure it has execute permissions
49
 
 
 
 
50
  # Run the start script
51
  CMD ["/start.sh"]
52
 
 
13
  # Clone GitHub repo into /app
14
  RUN git clone https://github.com/Mekhlafi98/solverai.git -b develop2 /app
15
 
16
+ # Install Python dependencies
17
+ RUN pip install --no-cache-dir --upgrade pip gunicorn && \
18
+ pip install --no-cache-dir -r requirements.txt
19
+
20
+ # Set environment variables
21
  ENV PATH="/home/user/.local/bin:$PATH" \
22
  OCR_API_TOKEN=${OCR_API_TOKEN} \
23
  GOOGLE_API_KEY=${GOOGLE_API_KEY} \
 
25
  MODEL_NAME=gemini-1.5-flash \
26
  ALLOWED_HOSTS=localhost,127.0.0.1,azeez98-solveai.hf.space
27
 
 
 
 
 
28
  # Collect static files (run this as root, since you may need write access to the files)
29
  USER root
30
  RUN python manage.py collectstatic --noinput
 
44
  # Copy the start script
45
  COPY start.sh /start.sh
46
 
47
+ # Change the file permissions as root (before switching to user)
48
+ USER root
49
  RUN chmod +x /start.sh # Ensure it has execute permissions
50
 
51
+ # Switch back to the 'user' user to run the app
52
+ USER user
53
+
54
  # Run the start script
55
  CMD ["/start.sh"]
56