LuillY3 commited on
Commit
46db8e7
·
verified ·
1 Parent(s): aefc39f

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +34 -23
Dockerfile CHANGED
@@ -1,35 +1,46 @@
1
- FROM evoapicloud/evolution-api AS base
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  USER root
 
4
 
5
- RUN apk add --no-cache chromium nss freetype harfbuzz ca-certificates ttf-freefont git
 
 
 
6
 
7
  ENV PUPPETEER_SKIP_DOWNLOAD=true
8
  ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
9
  ENV CHROME_BIN=/usr/bin/chromium-browser
10
- ENV CHROME_PATH=/usr/bin/chromium-browser
11
  ENV CHROME_ARGS="--no-sandbox --disable-setuid-sandbox --disable-dev-shm-usage --disable-gpu --single-process --no-zygote"
12
 
13
- # --- CIRUGÍA ESPECÍFICA ---
14
- # En lugar de buscar, vamos a crear el archivo en las 2 rutas posibles.
15
- # Si la carpeta no existe, mkdir -p la crea para evitar errores, aunque sea inútil.
16
- # Pero lo más probable es que esté en /evolution/node_modules
17
-
18
- RUN sh -c ' \
19
- CODE="\"use strict\"; Object.defineProperty(exports, \"__esModule\", { value: true }); exports.fetchLatestBaileysVersion = void 0; const fetchLatestBaileysVersion = async (options) => { console.log(\"FORZANDO VERSION BAILEYS: 2.3000.1032975692\"); return { version: [2, 3000, 1032975692], isLatest: true }; }; exports.fetchLatestBaileysVersion = fetchLatestBaileysVersion;"; \
20
- \
21
- TARGET1="/evolution/node_modules/@whiskeysockets/baileys/lib/Utils/fetch-latest-baileys-version.js"; \
22
- TARGET2="/app/node_modules/@whiskeysockets/baileys/lib/Utils/fetch-latest-baileys-version.js"; \
23
- \
24
- if [ -f "$TARGET1" ]; then echo "$CODE" > "$TARGET1" && echo "PARCHE APLICADO EN: $TARGET1"; fi; \
25
- if [ -f "$TARGET2" ]; then echo "$CODE" > "$TARGET2" && echo "PARCHE APLICADO EN: $TARGET2"; fi; \
26
- '
27
-
28
  ENV SERVER_PORT=7860
29
  EXPOSE 7860
30
- ENV DATABASE_ENABLED=true
31
- ENV DATABASE_PROVIDER=postgresql
32
- ENV CACHE_REDIS_ENABLED=true
33
- ENV CACHE_LOCAL_ENABLED=false
34
-
35
  CMD ["node", "./dist/src/main.js"]
 
1
+ FROM node:20-alpine AS builder
2
+
3
+ # Instalar dependencias
4
+ RUN apk add --no-cache git python3 make g++
5
+
6
+ # Clonar repo oficial
7
+ WORKDIR /evolution
8
+ RUN git clone https://github.com/EvolutionAPI/evolution-api.git .
9
+ RUN git checkout v2.2.3
10
+
11
+ # Instalar dependencias de Node
12
+ RUN npm install
13
+
14
+ # --- AQUI APLICAMOS EL PARCHE ANTES DE COMPILAR ---
15
+ RUN echo ' \
16
+ "use strict"; \
17
+ Object.defineProperty(exports, "__esModule", { value: true }); \
18
+ exports.fetchLatestBaileysVersion = void 0; \
19
+ const fetchLatestBaileysVersion = async (options) => { \
20
+ return { version: [2, 3000, 1032975692], isLatest: true }; \
21
+ }; \
22
+ exports.fetchLatestBaileysVersion = fetchLatestBaileysVersion; \
23
+ ' > ./node_modules/@whiskeysockets/baileys/lib/Utils/fetch-latest-baileys-version.js
24
+
25
+ # Compilar
26
+ RUN npm run build
27
+
28
+ # --- Imagen final ---
29
+ FROM node:20-alpine
30
 
31
  USER root
32
+ RUN apk add --no-cache chromium nss freetype harfbuzz ca-certificates ttf-freefont
33
 
34
+ WORKDIR /evolution
35
+ COPY --from=builder /evolution/dist ./dist
36
+ COPY --from=builder /evolution/node_modules ./node_modules
37
+ COPY --from=builder /evolution/package.json .
38
 
39
  ENV PUPPETEER_SKIP_DOWNLOAD=true
40
  ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
41
  ENV CHROME_BIN=/usr/bin/chromium-browser
 
42
  ENV CHROME_ARGS="--no-sandbox --disable-setuid-sandbox --disable-dev-shm-usage --disable-gpu --single-process --no-zygote"
43
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  ENV SERVER_PORT=7860
45
  EXPOSE 7860
 
 
 
 
 
46
  CMD ["node", "./dist/src/main.js"]