JPSolutions commited on
Commit
ed2e87f
·
verified ·
1 Parent(s): abac852

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +26 -32
Dockerfile CHANGED
@@ -6,62 +6,56 @@ RUN apk add --no-cache git
6
  # Clonar el repositorio completo
7
  RUN git clone https://github.com/evolution-foundation/evo-crm-community.git .
8
 
9
- # Localizar package.json, instalar y compilar el frontend dinámicamente
10
- RUN PACKAGE_PATH=$(find . -name "package.json" -not -path "*/node_modules/*" | head -n 1) && \
11
- if [ -n "$PACKAGE_PATH" ]; then \
12
- PACKAGE_DIR=$(dirname "$PACKAGE_PATH") && \
13
- echo "==> Frontend detectado en: $PACKAGE_DIR" && \
14
- cd "$PACKAGE_DIR" && \
15
- npm install && \
16
- npm run build && \
17
- mkdir -p /build/dist_output && \
18
- if [ -d "dist" ]; then cp -r dist/* /build/dist_output/; \
19
- elif [ -d "build" ]; then cp -r build/* /build/dist_output/; \
20
- fi \
21
- else \
22
- echo "==> No se encontró package.json"; \
23
- mkdir -p /build/dist_output; \
24
- fi
25
 
26
 
27
- # --- Etapa 2: Entorno de Ejecución Multitarea ---
28
  FROM ubuntu:22.04
29
 
30
  ENV DEBIAN_FRONTEND=noninteractive
31
- ENV RAILS_ENV=production
32
 
33
- # Instalar librerías base del sistema
34
  RUN apt-get update && apt-get install -y \
35
- ruby-full \
36
- build-essential \
37
- libpq-dev \
38
  python3 \
39
  python3-pip \
40
  nginx \
41
  supervisor \
42
- curl \
43
  git \
 
44
  && rm -rf /var/lib/apt/lists/*
45
 
46
- # Instalar bundler y uvicorn/fastapi globalmente en el sistema
47
- RUN gem install bundler
48
  RUN pip3 install --no-cache-dir uvicorn fastapi
49
 
50
  WORKDIR /app
51
 
52
- # Clonar el repositorio completo en la aplicación
53
  RUN git clone https://github.com/evolution-foundation/evo-crm-community.git .
54
 
55
  # Copiar el frontend compilado a la carpeta pública de Nginx
56
  COPY --from=frontend-builder /build/dist_output /var/www/html/
57
 
58
- # Instalar dependencias de Ruby en TODAS las subcarpetas que tengan un Gemfile
59
- RUN find /app -name "Gemfile" -not -path "*/vendor/*" -execdir bundle config set --local without 'development test' \; -execdir bundle install \;
60
-
61
- # Instalar dependencias de Python en TODAS las subcarpetas con requirements.txt
62
- RUN find /app -name "requirements.txt" -not -path "*/env/*" -exec pip3 install --no-cache-dir -r {} \;
 
 
 
 
 
 
 
 
 
63
 
64
- # Copiar la configuración de Supervisor
65
  COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
66
 
67
  EXPOSE 7860
 
6
  # Clonar el repositorio completo
7
  RUN git clone https://github.com/evolution-foundation/evo-crm-community.git .
8
 
9
+ # Compilar la app web dentro de evo-ai-frontend-community
10
+ RUN cd evo-ai-frontend-community && \
11
+ npm install && \
12
+ npm run build && \
13
+ mkdir -p /build/dist_output && \
14
+ cp -r dist/* /build/dist_output/ 2>/dev/null || cp -r build/* /build/dist_output/ 2>/dev/null || true
 
 
 
 
 
 
 
 
 
 
15
 
16
 
17
+ # --- Etapa 2: Entorno de Ejecución ---
18
  FROM ubuntu:22.04
19
 
20
  ENV DEBIAN_FRONTEND=noninteractive
 
21
 
22
+ # Instalar librerías del sistema
23
  RUN apt-get update && apt-get install -y \
24
+ nodejs \
25
+ npm \
 
26
  python3 \
27
  python3-pip \
28
  nginx \
29
  supervisor \
 
30
  git \
31
+ curl \
32
  && rm -rf /var/lib/apt/lists/*
33
 
 
 
34
  RUN pip3 install --no-cache-dir uvicorn fastapi
35
 
36
  WORKDIR /app
37
 
38
+ # Clonar el código fuente completo
39
  RUN git clone https://github.com/evolution-foundation/evo-crm-community.git .
40
 
41
  # Copiar el frontend compilado a la carpeta pública de Nginx
42
  COPY --from=frontend-builder /build/dist_output /var/www/html/
43
 
44
+ # Instalar dependencias de Node en los subproyectos que las requieran
45
+ RUN cd /app/evo-ai-crm-community && npm install 2>/dev/null || true
46
+ RUN cd /app/evo-auth-service-community && npm install 2>/dev/null || true
47
+
48
+ # Configurar Nginx para escuchar en el puerto 7860 y soportar rutas SPA (React/Vite)
49
+ RUN echo 'server { \
50
+ listen 7860; \
51
+ server_name _; \
52
+ root /var/www/html; \
53
+ index index.html; \
54
+ location / { \
55
+ try_files $uri $uri/ /index.html; \
56
+ } \
57
+ }' > /etc/nginx/sites-available/default
58
 
 
59
  COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
60
 
61
  EXPOSE 7860