comit
Browse files- Dockerfile +9 -7
- utils/logger.py +3 -1
Dockerfile
CHANGED
|
@@ -1,18 +1,20 @@
|
|
| 1 |
-
# Use
|
| 2 |
FROM python:3.9-slim
|
| 3 |
|
| 4 |
-
# Set the working directory
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
-
# Copy
|
| 8 |
COPY . /app
|
| 9 |
|
| 10 |
-
#
|
| 11 |
-
RUN
|
| 12 |
|
| 13 |
-
#
|
|
|
|
|
|
|
|
|
|
| 14 |
EXPOSE 7860
|
| 15 |
|
| 16 |
# Command to run the application
|
| 17 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
| 18 |
-
|
|
|
|
| 1 |
+
# Use a base image
|
| 2 |
FROM python:3.9-slim
|
| 3 |
|
| 4 |
+
# Set the working directory
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
+
# Copy project files
|
| 8 |
COPY . /app
|
| 9 |
|
| 10 |
+
# Ensure the logs directory exists and is writable
|
| 11 |
+
RUN mkdir -p logs && chmod -R 777 logs
|
| 12 |
|
| 13 |
+
# Install dependencies
|
| 14 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 15 |
+
|
| 16 |
+
# Expose the application port
|
| 17 |
EXPOSE 7860
|
| 18 |
|
| 19 |
# Command to run the application
|
| 20 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
utils/logger.py
CHANGED
|
@@ -2,7 +2,9 @@ import logging
|
|
| 2 |
import os
|
| 3 |
|
| 4 |
# Ensure the 'logs' directory exists
|
| 5 |
-
log_dir = "logs"
|
|
|
|
|
|
|
| 6 |
os.makedirs(log_dir, exist_ok=True)
|
| 7 |
|
| 8 |
# Configure logging
|
|
|
|
| 2 |
import os
|
| 3 |
|
| 4 |
# Ensure the 'logs' directory exists
|
| 5 |
+
log_dir = "logs" # Use a relative path to avoid permission issues
|
| 6 |
+
log_file = f"{log_dir}/app.log"
|
| 7 |
+
|
| 8 |
os.makedirs(log_dir, exist_ok=True)
|
| 9 |
|
| 10 |
# Configure logging
|