Spaces:
Paused
Paused
Update Dockerfile
Browse files- 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 |
-
#
|
| 10 |
-
RUN
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 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
|
| 28 |
FROM ubuntu:22.04
|
| 29 |
|
| 30 |
ENV DEBIAN_FRONTEND=noninteractive
|
| 31 |
-
ENV RAILS_ENV=production
|
| 32 |
|
| 33 |
-
# Instalar librerías
|
| 34 |
RUN apt-get update && apt-get install -y \
|
| 35 |
-
|
| 36 |
-
|
| 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
|
| 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
|
| 59 |
-
RUN
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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
|