wjbmattingly commited on
Commit
2eb47a2
·
verified ·
1 Parent(s): d2f9d2f

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +27 -5
Dockerfile CHANGED
@@ -104,6 +104,25 @@ SESSION_ENGINE = "django.contrib.sessions.backends.cache"\n\
104
  SESSION_CACHE_ALIAS = "default"\n\
105
  SESSION_COOKIE_AGE = 86400 # 24 hours\n\
106
  \n\
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
  ' > /app/vlamy_ocr/settings_no_auth.py
108
 
109
  # Create a custom URL configuration for no-auth mode
@@ -128,9 +147,6 @@ if settings.DEBUG:\n\
128
  urlpatterns += staticfiles_urlpatterns()\n\
129
  ' > /app/vlamy_ocr/urls_no_auth.py
130
 
131
- # Set proper permissions
132
- RUN chmod -R 755 /app
133
-
134
  # Collect static files
135
  RUN DJANGO_SETTINGS_MODULE=vlamy_ocr.settings_no_auth python manage.py collectstatic --noinput
136
 
@@ -140,7 +156,8 @@ RUN echo '#!/bin/bash\n\
140
  # Set the custom settings module\n\
141
  export DJANGO_SETTINGS_MODULE=vlamy_ocr.settings_no_auth\n\
142
  \n\
143
- # Replace the main urls.py with no-auth version\n\
 
144
  cp /app/vlamy_ocr/urls_no_auth.py /app/vlamy_ocr/urls.py\n\
145
  \n\
146
  # Run migrations for in-memory database (required for each startup)\n\
@@ -155,7 +172,12 @@ if not User.objects.filter(username=\"anonymous\").exists():\n\
155
  \n\
156
  # Start the Django development server\n\
157
  python manage.py runserver 0.0.0.0:$PORT\n\
158
- ' > /app/start.sh && chmod +x /app/start.sh
 
 
 
 
 
159
 
160
  # Environment variables for production (no-auth mode)
161
  ENV DEBUG=False
 
104
  SESSION_CACHE_ALIAS = "default"\n\
105
  SESSION_COOKIE_AGE = 86400 # 24 hours\n\
106
  \n\
107
+ # Disable file logging to avoid permission issues\n\
108
+ LOGGING = {\n\
109
+ "version": 1,\n\
110
+ "disable_existing_loggers": False,\n\
111
+ "handlers": {\n\
112
+ "console": {\n\
113
+ "level": "INFO",\n\
114
+ "class": "logging.StreamHandler",\n\
115
+ },\n\
116
+ },\n\
117
+ "loggers": {\n\
118
+ "ocr_app": {\n\
119
+ "handlers": ["console"],\n\
120
+ "level": "INFO",\n\
121
+ "propagate": True,\n\
122
+ },\n\
123
+ },\n\
124
+ }\n\
125
+ \n\
126
  ' > /app/vlamy_ocr/settings_no_auth.py
127
 
128
  # Create a custom URL configuration for no-auth mode
 
147
  urlpatterns += staticfiles_urlpatterns()\n\
148
  ' > /app/vlamy_ocr/urls_no_auth.py
149
 
 
 
 
150
  # Collect static files
151
  RUN DJANGO_SETTINGS_MODULE=vlamy_ocr.settings_no_auth python manage.py collectstatic --noinput
152
 
 
156
  # Set the custom settings module\n\
157
  export DJANGO_SETTINGS_MODULE=vlamy_ocr.settings_no_auth\n\
158
  \n\
159
+ # Replace the main urls.py with no-auth version (create backup first)\n\
160
+ cp /app/vlamy_ocr/urls.py /app/vlamy_ocr/urls_original.py\n\
161
  cp /app/vlamy_ocr/urls_no_auth.py /app/vlamy_ocr/urls.py\n\
162
  \n\
163
  # Run migrations for in-memory database (required for each startup)\n\
 
172
  \n\
173
  # Start the Django development server\n\
174
  python manage.py runserver 0.0.0.0:$PORT\n\
175
+ ' > /app/start.sh
176
+
177
+ # Set proper permissions for all files and ensure startup script is executable
178
+ RUN chmod -R 755 /app && \
179
+ chmod +x /app/start.sh && \
180
+ chown -R root:root /app
181
 
182
  # Environment variables for production (no-auth mode)
183
  ENV DEBUG=False