Skip to content

Commit

Permalink
Se crea la imagen docker
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidKingV committed Jun 24, 2024
1 parent 70e581b commit 8d66db6
Show file tree
Hide file tree
Showing 5 changed files with 124 additions and 438 deletions.
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
node_modules
npm-debug.log

.wwebjs_auth
.wwebjs_cache

.env
51 changes: 51 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Usa una imagen base de Node.js 20
FROM node:20

# Establece el directorio de trabajo dentro del contenedor
WORKDIR /app

# Copia el package.json y el package-lock.json (si existe)
COPY package*.json ./

# Instala las dependencias del proyecto
RUN npm install

# Instala las dependencias del sistema necesarias para Puppeteer
RUN apt-get update && apt-get install -y \
wget \
ca-certificates \
fonts-liberation \
libappindicator3-1 \
libasound2 \
libatk-bridge2.0-0 \
libatk1.0-0 \
libcups2 \
libdbus-1-3 \
libdrm2 \
libgbm1 \
libnspr4 \
libnss3 \
libxcomposite1 \
libxdamage1 \
libxrandr2 \
xdg-utils \
chromium \
--no-install-recommends \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

# Verifica la ubicación del ejecutable de Chromium
RUN which chromium

# Establece variables de entorno necesarias para Puppeteer
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true \
PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium

# Copia el resto del código de la aplicación
COPY . .

# Expone el puerto en el que la aplicación va a correr
EXPOSE 3000

# Comando para ejecutar la aplicación
CMD ["npm", "start"]
10 changes: 9 additions & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,15 @@ let isAuthenticated = false; // Variable para verificar si está autenticado
let qrCodeData = '';

const client = new Client({
authStrategy: new LocalAuth()
webVersionCache: {
type: 'remote',
remotePath: 'https://raw.githubusercontent.com/wppconnect-team/wa-version/main/html/2.2410.1.html',
},
authStrategy: new LocalAuth(),
puppeteer: {
args: ['--no-sandbox', '--disable-setuid-sandbox']
}

});

client.on('ready', () => {
Expand Down
Loading

0 comments on commit 8d66db6

Please sign in to comment.