Kiran5 commited on
Commit
2a46da5
·
1 Parent(s): 0b16b51

adding files

Browse files
Files changed (2) hide show
  1. Dockerfile +3 -0
  2. main.py +2 -1
Dockerfile CHANGED
@@ -16,6 +16,9 @@ COPY --chown=user ./lib/privacy-1.0.9-py3-none-any.whl /lib/
16
  # Install dependencies
17
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
18
 
 
 
 
19
  # Expose the port used by Hugging Face Spaces (7860)
20
  EXPOSE 7860
21
 
 
16
  # Install dependencies
17
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
18
 
19
+ # Ensure log directory exists and is writable by the non-root user
20
+ RUN mkdir -p /home/user/logs && chown -R user:user /home/user/logs
21
+
22
  # Expose the port used by Hugging Face Spaces (7860)
23
  EXPOSE 7860
24
 
main.py CHANGED
@@ -153,7 +153,7 @@ def internal_server_error_handler(exc):
153
  return response
154
 
155
  # Ensure that log directories exist and are writable
156
- log_dir = '/path/to/logs' # Update this path as needed
157
  if not os.path.exists(log_dir):
158
  os.makedirs(log_dir, exist_ok=True)
159
 
@@ -183,3 +183,4 @@ if __name__ == "__main__":
183
 
184
 
185
 
 
 
153
  return response
154
 
155
  # Ensure that log directories exist and are writable
156
+ log_dir = '/home/user/logs' # Update to a directory inside user's home directory
157
  if not os.path.exists(log_dir):
158
  os.makedirs(log_dir, exist_ok=True)
159
 
 
183
 
184
 
185
 
186
+