JPSolutions commited on
Commit
fdab4d9
·
verified ·
1 Parent(s): 73b82a5

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +19 -5
Dockerfile CHANGED
@@ -73,11 +73,25 @@ RUN echo 'server { listen 7860; server_name _; root /var/www/html; index index.h
73
 
74
  COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
75
 
76
- # Parchear las migraciones defectuosas del repositorio antes de ejecutar db:prepare
77
- RUN find /app -name "*add_facebook_comment_config_to_agent_bot_inboxes.rb" -exec sed -i 's/:uuid/:bigint/g' {} +
78
- RUN find /app -name "*20250819224900_init_schema.rb" -exec sed -i 's/.*email_otp_sent_at.*/# &/g' {} +
79
-
80
- # Entrypoint corregido: ejecuta db:prepare dentro de cada carpeta con Gemfile
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
  RUN printf '#!/bin/bash\n\
82
  echo "==> Ejecutando migraciones y preparando la base de datos en los modulos..."\n\
83
  find /app -name "Gemfile" -not -path "*/vendor/*" -execdir bundle exec rails db:prepare \;\n\
 
73
 
74
  COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
75
 
76
+ # Parche de seguridad para corregir todas las migraciones inconsistentes del repositorio
77
+ RUN ruby -e ' \
78
+ Dir.glob("/app/**/db/migrate/*.rb").each do |file| \
79
+ content = File.read(file); \
80
+ if file.include?("add_facebook_comment_config_to_agent_bot_inboxes") \
81
+ content = content.gsub(":uuid", ":bigint"); \
82
+ end; \
83
+ if file.include?("create_facebook_comment_moderations") \
84
+ content = content.gsub(":uuid", ":integer").gsub("type: :uuid", "type: :integer"); \
85
+ end; \
86
+ if file.include?("20250819224900_init_schema.rb") \
87
+ content = content.lines.map do |line| \
88
+ (line =~ /add_index\s+:users/ && line !~ /:email\b|:reset_password_token\b/) ? "# #{line}" : line \
89
+ end.join; \
90
+ end; \
91
+ File.write(file, content); \
92
+ end'
93
+
94
+ # Entrypoint: ejecuta db:prepare en los módulos de backend
95
  RUN printf '#!/bin/bash\n\
96
  echo "==> Ejecutando migraciones y preparando la base de datos en los modulos..."\n\
97
  find /app -name "Gemfile" -not -path "*/vendor/*" -execdir bundle exec rails db:prepare \;\n\