FROM node:18-alpine # Install dependencies for Puppeteer RUN apk add --no-cache \ chromium \ nss \ freetype \ harfbuzz \ ca-certificates \ ttf-freefont \ wget # Tell Puppeteer to skip installing Chrome. We'll use the installed package. ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true \ PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser # Create app directory WORKDIR /app # Copy package files COPY package*.json ./ # Install dependencies RUN npm ci --only=production # Copy application files COPY . . # Create output directory for screenshots RUN mkdir -p /var/www/html/images && \ chown -R node:node /var/www/html/images # Use non-root user USER node # Expose port EXPOSE 5955 # Health check HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ CMD node -e "require('http').get('http://localhost:5955/health', (r) => {process.exit(r.statusCode === 200 ? 0 : 1)})" # Start application CMD ["node", "server.js"]