martynka commited on
Commit
0ed11fb
·
verified ·
1 Parent(s): cfaf840

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +17 -8
Dockerfile CHANGED
@@ -19,6 +19,7 @@ RUN apk update && apk add --no-cache \
19
  && chmod -R 777 /app/uploads/temp \
20
  && chmod -R 777 /app/client/public/images \
21
  && chmod -R 777 /app/api/logs
 
22
 
23
  # ===== Admin Panel =====
24
  COPY <<"EOF" /app/admin/app.py
@@ -245,10 +246,13 @@ document.addEventListener('DOMContentLoaded', () => {
245
  EOF
246
 
247
  # NGINX Configuration
248
- COPY <<"EOF" /etc/nginx/nginx.conf
249
- user nginx;
250
  worker_processes auto;
251
 
 
 
 
252
  events {
253
  worker_connections 1024;
254
  }
@@ -263,7 +267,9 @@ http {
263
  server {
264
  listen 7860;
265
  server_name localhost;
 
266
 
 
267
  location / {
268
  proxy_pass http://localhost:3080;
269
  proxy_set_header Host \$host;
@@ -271,17 +277,20 @@ http {
271
  proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
272
  }
273
 
 
274
  location /sudo {
275
  proxy_pass http://localhost:5000;
276
  proxy_set_header X-Sudo-Secret \$http_x_sudo_secret;
277
  }
278
 
 
279
  location /static {
280
  alias /app/admin/static;
 
 
281
  }
282
 
283
- access_log /dev/stdout;
284
- error_log /dev/stderr;
285
  }
286
  }
287
  EOF
@@ -290,17 +299,17 @@ EOF
290
  COPY <<"EOF" /start.sh
291
  #!/bin/sh
292
  # Fix permissions
293
- chown -R nginx:nginx /var/lib/nginx
294
- chmod -R 770 /var/lib/nginx
295
 
296
  # Start LibreChat (using the correct command)
297
- cd /app && npm run start:backend &
298
 
299
  # Start Admin Panel
300
  cd /app/admin && python3 app.py &
301
 
302
  # Start NGINX
303
- nginx -g "daemon off;"
304
 
305
  # Keep container running
306
  wait
 
19
  && chmod -R 777 /app/uploads/temp \
20
  && chmod -R 777 /app/client/public/images \
21
  && chmod -R 777 /app/api/logs
22
+ RUN mkdir -p /app/{nginx/{conf,logs,run,tmp},admin/{templates,static},data,uploads,client/public/images,api/logs}
23
 
24
  # ===== Admin Panel =====
25
  COPY <<"EOF" /app/admin/app.py
 
246
  EOF
247
 
248
  # NGINX Configuration
249
+ COPY <<"EOF" /app/nginx/conf/nginx.conf
250
+ user 1000;
251
  worker_processes auto;
252
 
253
+ error_log /app/nginx/logs/error.log warn;
254
+ pid /app/nginx/run/nginx.pid;
255
+
256
  events {
257
  worker_connections 1024;
258
  }
 
267
  server {
268
  listen 7860;
269
  server_name localhost;
270
+ root /app;
271
 
272
+ # LibreChat API
273
  location / {
274
  proxy_pass http://localhost:3080;
275
  proxy_set_header Host \$host;
 
277
  proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
278
  }
279
 
280
+ # Admin Panel
281
  location /sudo {
282
  proxy_pass http://localhost:5000;
283
  proxy_set_header X-Sudo-Secret \$http_x_sudo_secret;
284
  }
285
 
286
+ # Static files
287
  location /static {
288
  alias /app/admin/static;
289
+ expires 30d;
290
+ access_log off;
291
  }
292
 
293
+ access_log /app/nginx/logs/access.log;
 
294
  }
295
  }
296
  EOF
 
299
  COPY <<"EOF" /start.sh
300
  #!/bin/sh
301
  # Fix permissions
302
+ #chown -R nginx:nginx /var/lib/nginx
303
+ #chmod -R 770 /var/lib/nginx
304
 
305
  # Start LibreChat (using the correct command)
306
+ cd /app && npm run &
307
 
308
  # Start Admin Panel
309
  cd /app/admin && python3 app.py &
310
 
311
  # Start NGINX
312
+ nginx -g "daemon off;" -c /app/nginx/conf/nginx.conf
313
 
314
  # Keep container running
315
  wait