Spaces:
Paused
Paused
Update Dockerfile
Browse files- Dockerfile +6 -17
Dockerfile
CHANGED
|
@@ -1,52 +1,41 @@
|
|
| 1 |
-
# 1. Usamos la imagen base de Node
|
| 2 |
FROM node:20-alpine AS builder
|
| 3 |
|
| 4 |
-
# Instalar herramientas de compilación
|
| 5 |
RUN apk add --no-cache git python3 make g++
|
| 6 |
|
| 7 |
-
# 2. Clonar el Repo Oficial (Rama Main para tener EvoAI)
|
| 8 |
WORKDIR /evolution
|
| 9 |
RUN git clone https://github.com/EvolutionAPI/evolution-api.git .
|
| 10 |
RUN git checkout main
|
| 11 |
|
| 12 |
-
# 3. Instalar Dependencias
|
| 13 |
RUN npm install
|
| 14 |
|
| 15 |
-
#
|
| 16 |
-
#
|
| 17 |
-
|
| 18 |
-
RUN echo '"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.fetchLatestBaileysVersion = void 0; const fetchLatestBaileysVersion = async (options) => { console.log("FORZANDO VERSION: 2.3000.1032975692"); return { version: [2, 3000, 1032975692], isLatest: true }; }; exports.fetchLatestBaileysVersion = fetchLatestBaileysVersion;' > ./node_modules/@whiskeysockets/baileys/lib/Utils/fetch-latest-baileys-version.js
|
| 19 |
|
| 20 |
-
# 5. Compilar
|
| 21 |
RUN npm run build
|
| 22 |
|
| 23 |
-
# --- IMAGEN FINAL
|
| 24 |
FROM node:20-alpine
|
| 25 |
|
| 26 |
USER root
|
| 27 |
-
# Instalar Chromium para Puppeteer (necesario para el QR de Baileys)
|
| 28 |
RUN apk add --no-cache chromium nss freetype harfbuzz ca-certificates ttf-freefont
|
| 29 |
|
| 30 |
WORKDIR /evolution
|
| 31 |
COPY --from=builder /evolution/dist ./dist
|
| 32 |
COPY --from=builder /evolution/node_modules ./node_modules
|
| 33 |
COPY --from=builder /evolution/package.json .
|
| 34 |
-
COPY --from=builder /evolution/public ./public || true
|
| 35 |
|
| 36 |
-
# Configuración del Navegador (WhatsApp Web)
|
| 37 |
ENV PUPPETEER_SKIP_DOWNLOAD=true
|
| 38 |
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
|
| 39 |
ENV CHROME_BIN=/usr/bin/chromium-browser
|
| 40 |
ENV CHROME_ARGS="--no-sandbox --disable-setuid-sandbox --disable-dev-shm-usage --disable-gpu --single-process --no-zygote"
|
| 41 |
|
| 42 |
-
#
|
| 43 |
-
# Estas variables habilitan los módulos de IA en el código compilado
|
| 44 |
ENV EVOAI_ENABLED=true
|
| 45 |
ENV OPENAI_ENABLED=true
|
| 46 |
ENV DIFY_ENABLED=true
|
| 47 |
|
| 48 |
-
# Puertos
|
| 49 |
ENV SERVER_PORT=7860
|
| 50 |
EXPOSE 7860
|
| 51 |
-
|
| 52 |
CMD ["node", "./dist/src/main.js"]
|
|
|
|
|
|
|
| 1 |
FROM node:20-alpine AS builder
|
| 2 |
|
|
|
|
| 3 |
RUN apk add --no-cache git python3 make g++
|
| 4 |
|
|
|
|
| 5 |
WORKDIR /evolution
|
| 6 |
RUN git clone https://github.com/EvolutionAPI/evolution-api.git .
|
| 7 |
RUN git checkout main
|
| 8 |
|
|
|
|
| 9 |
RUN npm install
|
| 10 |
|
| 11 |
+
# --- PARCHE INTELIGENTE CON BÚSQUEDA AUTOMÁTICA ---
|
| 12 |
+
# Busca el archivo y si lo encuentra, lo reemplaza. Si no existe, no hace nada (|| true)
|
| 13 |
+
RUN find ./node_modules -name "fetch-latest-baileys-version.js" -type f -exec sh -c 'echo "\"use strict\"; Object.defineProperty(exports, \"__esModule\", { value: true }); exports.fetchLatestBaileysVersion = void 0; const fetchLatestBaileysVersion = async (options) => { console.log(\"FORZANDO VERSION: 2.3000.1032975692\"); return { version: [2, 3000, 1032975692], isLatest: true }; }; exports.fetchLatestBaileysVersion = fetchLatestBaileysVersion;" > {}' \; 2>/dev/null || echo "Archivo de versión de Baileys no encontrado, continuando..."
|
|
|
|
| 14 |
|
|
|
|
| 15 |
RUN npm run build
|
| 16 |
|
| 17 |
+
# --- IMAGEN FINAL ---
|
| 18 |
FROM node:20-alpine
|
| 19 |
|
| 20 |
USER root
|
|
|
|
| 21 |
RUN apk add --no-cache chromium nss freetype harfbuzz ca-certificates ttf-freefont
|
| 22 |
|
| 23 |
WORKDIR /evolution
|
| 24 |
COPY --from=builder /evolution/dist ./dist
|
| 25 |
COPY --from=builder /evolution/node_modules ./node_modules
|
| 26 |
COPY --from=builder /evolution/package.json .
|
| 27 |
+
COPY --from=builder /evolution/public ./public 2>/dev/null || true
|
| 28 |
|
|
|
|
| 29 |
ENV PUPPETEER_SKIP_DOWNLOAD=true
|
| 30 |
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
|
| 31 |
ENV CHROME_BIN=/usr/bin/chromium-browser
|
| 32 |
ENV CHROME_ARGS="--no-sandbox --disable-setuid-sandbox --disable-dev-shm-usage --disable-gpu --single-process --no-zygote"
|
| 33 |
|
| 34 |
+
# Habilitar módulos de IA
|
|
|
|
| 35 |
ENV EVOAI_ENABLED=true
|
| 36 |
ENV OPENAI_ENABLED=true
|
| 37 |
ENV DIFY_ENABLED=true
|
| 38 |
|
|
|
|
| 39 |
ENV SERVER_PORT=7860
|
| 40 |
EXPOSE 7860
|
|
|
|
| 41 |
CMD ["node", "./dist/src/main.js"]
|