Merge branch 'dev' into feature/meta-whatsapp-api
Some checks are pending
Deploy Dev / deploy (push) Waiting to run
Some checks are pending
Deploy Dev / deploy (push) Waiting to run
This commit is contained in:
commit
d39a03c05f
@ -1,7 +1,9 @@
|
|||||||
FROM node:20-alpine
|
FROM node:20-alpine
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
RUN apk add --no-cache chromium nss freetype harfbuzz ca-certificates ttf-freefont
|
||||||
|
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
|
||||||
COPY package*.json ./
|
COPY package*.json ./
|
||||||
RUN npm ci
|
RUN npm ci
|
||||||
COPY . .
|
COPY . .
|
||||||
EXPOSE 3001
|
EXPOSE 3001
|
||||||
CMD ["npm", "run", "dev"]
|
CMD ["npm", "run", "dev:docker"]
|
||||||
|
|||||||
@ -7,7 +7,8 @@
|
|||||||
"start": "cross-env NODE_ENV=production node dist/main.js",
|
"start": "cross-env NODE_ENV=production node dist/main.js",
|
||||||
"predev": "node scripts/ensure-port-free.js",
|
"predev": "node scripts/ensure-port-free.js",
|
||||||
"dev": "cross-env NODE_ENV=development nest start --watch",
|
"dev": "cross-env NODE_ENV=development nest start --watch",
|
||||||
"start:dev": "npm run dev"
|
"start:dev": "npm run dev",
|
||||||
|
"dev:docker": "cross-env NODE_ENV=development nest start --watch"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@nestjs/common": "^11.1.19",
|
"@nestjs/common": "^11.1.19",
|
||||||
|
|||||||
@ -7,6 +7,18 @@ import { WhatsappTemplateService } from './whatsapp-template.service';
|
|||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
|
|
||||||
|
function getBrowserExecutablePath() {
|
||||||
|
if (process.env.PUPPETEER_EXECUTABLE_PATH) {
|
||||||
|
return process.env.PUPPETEER_EXECUTABLE_PATH;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (process.platform === 'win32') {
|
||||||
|
return 'C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe';
|
||||||
|
}
|
||||||
|
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class WhatsappService implements OnModuleInit {
|
export class WhatsappService implements OnModuleInit {
|
||||||
private client: Client;
|
private client: Client;
|
||||||
@ -31,7 +43,7 @@ export class WhatsappService implements OnModuleInit {
|
|||||||
authStrategy: new LocalAuth({ dataPath: './whatsapp-session' }),
|
authStrategy: new LocalAuth({ dataPath: './whatsapp-session' }),
|
||||||
puppeteer: {
|
puppeteer: {
|
||||||
headless: true,
|
headless: true,
|
||||||
executablePath: 'C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe',
|
executablePath: getBrowserExecutablePath(),
|
||||||
args: ['--no-sandbox', '--disable-setuid-sandbox', '--disable-dev-shm-usage', '--disable-accelerated-2d-canvas', '--no-first-run', '--disable-gpu']
|
args: ['--no-sandbox', '--disable-setuid-sandbox', '--disable-dev-shm-usage', '--disable-accelerated-2d-canvas', '--no-first-run', '--disable-gpu']
|
||||||
},
|
},
|
||||||
webVersionCache: {
|
webVersionCache: {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user