docker markdown working

This commit is contained in:
Generic Developer 2024-09-27 23:56:51 +00:00
parent 66e5d42d2e
commit 3d3863f369
2 changed files with 40 additions and 0 deletions

32
Dockerfile Normal file
View File

@ -0,0 +1,32 @@
# Use Node.js 18 slim image (Debian-based)
FROM node:18-slim
# Install necessary tools and libraries
RUN apt-get update && apt-get install -y \
chromium \
libmagic-dev \
build-essential \
python3 \
wget \
gnupg \
&& wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
&& apt-get update \
&& apt-get install -y google-chrome-stable \
&& rm -rf /var/lib/apt/lists/*
# Set environment variables
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
ENV PUPPETEER_EXECUTABLE_PATH /usr/bin/google-chrome-stable
# Set working directory
WORKDIR /app
# Copy package.json and package-lock.json
COPY backend/functions/package*.json ./
# Install dependencies
RUN npm ci
# Copy the rest of the application code
COPY backend/functions .
# Build the application
RUN npm run build
# Expose the port the app runs on
EXPOSE 3000
# Start the application
CMD ["node", "build/server.js"]

View File

@ -255,7 +255,15 @@ export class PuppeteerControl extends AsyncService {
this.browser.process()?.kill('SIGKILL'); this.browser.process()?.kill('SIGKILL');
} }
} }
const args = [
'--no-sandbox',
'--disable-setuid-sandbox',
'--disable-dev-shm-usage',
'--single-process'
];
this.browser = await puppeteer.launch({ this.browser = await puppeteer.launch({
args: args,
timeout: 10_000 timeout: 10_000
}).catch((err: any) => { }).catch((err: any) => {
this.logger.error(`Unknown firebase issue, just die fast.`, { err }); this.logger.error(`Unknown firebase issue, just die fast.`, { err });