Ahmedik95316 commited on
Commit
d205cc8
·
1 Parent(s): 0eac201

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +10 -19
Dockerfile CHANGED
@@ -7,7 +7,6 @@ ENV PYTHONUNBUFFERED=1 \
7
  STREAMLIT_SERVER_ADDRESS=0.0.0.0 \
8
  STREAMLIT_SERVER_PORT=7860
9
 
10
-
11
  # Install system dependencies
12
  RUN apt-get update && apt-get install -y \
13
  build-essential \
@@ -48,24 +47,13 @@ RUN mkdir -p /app/data /app/model /app/logs /app/cache /app/temp && \
48
  mkdir -p /app/data/kaggle && \
49
  mkdir -p /tmp/app_data /tmp/app_logs /tmp/app_cache
50
 
51
- # Set proper ownership FIRST, then permissions
52
- RUN chown -R appuser:appuser /app && \
53
- chown -R appuser:appuser /tmp/app_data /tmp/app_logs /tmp/app_cache
54
-
55
- # Set comprehensive permissions for data directories
56
- RUN chmod -R 775 /app/data /app/model /app/logs /app/cache /app/temp && \
57
- chmod -R 775 /tmp/app_data /tmp/app_logs /tmp/app_cache
58
-
59
- # Ensure specific write permissions for upload directories
60
- RUN chmod 777 /app/data /app/logs /tmp/app_data /tmp/app_logs
61
-
62
- # Make scripts executable
63
- RUN chmod +x /app/start.sh
64
-
65
  # Copy health check script and make it executable
66
  COPY health_check.sh /app/
67
  RUN chmod +x /app/health_check.sh
68
 
 
 
 
69
  # Copy initial datasets if they exist to the correct app structure
70
  RUN if [ -d /app/data/kaggle ]; then \
71
  echo "Kaggle datasets found in app structure"; \
@@ -76,12 +64,15 @@ RUN if [ -d /app/data/kaggle ]; then \
76
  chmod 664 /app/data/combined_dataset.csv; \
77
  fi
78
 
79
- # Switch to non-root user BEFORE initialization
80
- USER appuser
81
-
82
  RUN chown -R appuser:appuser /app && \
 
83
  chmod -R 755 /app && \
84
- chmod -R 777 /app/data /app/logs /app/cache /app/temp /app/model
 
 
 
 
85
 
86
  # Create user-writable directories in case the above fails
87
  RUN mkdir -p /tmp/fallback_data /tmp/fallback_logs && \
 
7
  STREAMLIT_SERVER_ADDRESS=0.0.0.0 \
8
  STREAMLIT_SERVER_PORT=7860
9
 
 
10
  # Install system dependencies
11
  RUN apt-get update && apt-get install -y \
12
  build-essential \
 
47
  mkdir -p /app/data/kaggle && \
48
  mkdir -p /tmp/app_data /tmp/app_logs /tmp/app_cache
49
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  # Copy health check script and make it executable
51
  COPY health_check.sh /app/
52
  RUN chmod +x /app/health_check.sh
53
 
54
+ # Make scripts executable
55
+ RUN chmod +x /app/start.sh
56
+
57
  # Copy initial datasets if they exist to the correct app structure
58
  RUN if [ -d /app/data/kaggle ]; then \
59
  echo "Kaggle datasets found in app structure"; \
 
64
  chmod 664 /app/data/combined_dataset.csv; \
65
  fi
66
 
67
+ # Set comprehensive permissions BEFORE switching users
 
 
68
  RUN chown -R appuser:appuser /app && \
69
+ chown -R appuser:appuser /tmp/app_data /tmp/app_logs /tmp/app_cache && \
70
  chmod -R 755 /app && \
71
+ chmod -R 777 /app/data /app/logs /app/cache /app/temp /app/model && \
72
+ chmod -R 775 /tmp/app_data /tmp/app_logs /tmp/app_cache
73
+
74
+ # Switch to non-root user AFTER setting permissions
75
+ USER appuser
76
 
77
  # Create user-writable directories in case the above fails
78
  RUN mkdir -p /tmp/fallback_data /tmp/fallback_logs && \