Spaces:
Paused
Paused
Update Dockerfile
Browse files- Dockerfile +11 -2
Dockerfile
CHANGED
|
@@ -72,7 +72,7 @@ RUN find /app -name "Gemfile" -not -path "*/vendor/*" -execdir bundle install \;
|
|
| 72 |
COPY nginx.conf /etc/nginx/nginx.conf
|
| 73 |
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
| 74 |
|
| 75 |
-
# Parche completo para migraciones
|
| 76 |
RUN printf '%s\n' \
|
| 77 |
'import glob' \
|
| 78 |
'for filepath in glob.glob("/app/**/*.rb", recursive=True):' \
|
|
@@ -90,8 +90,17 @@ RUN printf '%s\n' \
|
|
| 90 |
' injected = True' \
|
| 91 |
' content = "\n".join(new_lines)' \
|
| 92 |
' if "20260505155854_promote_first_user_to_super_admin.rb" in filepath:' \
|
| 93 |
-
' if "def up" in content and "attribute
|
| 94 |
' content = content.replace("def up", "def up\n User.attribute :mfa_method, :string rescue nil")' \
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
' if "db/migrate" in filepath:' \
|
| 96 |
' if "add_facebook_comment_config_to_agent_bot_inboxes" in filepath:' \
|
| 97 |
' content = content.replace(":uuid", ":bigint")' \
|
|
|
|
| 72 |
COPY nginx.conf /etc/nginx/nginx.conf
|
| 73 |
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
| 74 |
|
| 75 |
+
# Parche completo para migraciones, enum mfa_method y control de base de datos limpia en PromoteFirstUserToSuperAdmin
|
| 76 |
RUN printf '%s\n' \
|
| 77 |
'import glob' \
|
| 78 |
'for filepath in glob.glob("/app/**/*.rb", recursive=True):' \
|
|
|
|
| 90 |
' injected = True' \
|
| 91 |
' content = "\n".join(new_lines)' \
|
| 92 |
' if "20260505155854_promote_first_user_to_super_admin.rb" in filepath:' \
|
| 93 |
+
' if "def up" in content and "User.attribute" not in content:' \
|
| 94 |
' content = content.replace("def up", "def up\n User.attribute :mfa_method, :string rescue nil")' \
|
| 95 |
+
' lines = content.splitlines()' \
|
| 96 |
+
' new_lines = []' \
|
| 97 |
+
' guard_injected = False' \
|
| 98 |
+
' for line in lines:' \
|
| 99 |
+
' if not guard_injected and ("UserRole" in line or "user_roles" in line):' \
|
| 100 |
+
' new_lines.append(" return unless User.exists?")' \
|
| 101 |
+
' guard_injected = True' \
|
| 102 |
+
' new_lines.append(line)' \
|
| 103 |
+
' content = "\n".join(new_lines)' \
|
| 104 |
' if "db/migrate" in filepath:' \
|
| 105 |
' if "add_facebook_comment_config_to_agent_bot_inboxes" in filepath:' \
|
| 106 |
' content = content.replace(":uuid", ":bigint")' \
|