# Use Node.js LTS version FROM node:20-slim # Install Chromium and dependencies for Puppeteer RUN apt-get update && apt-get install -y \ chromium \ chromium-sandbox \ fonts-liberation \ libappindicator3-1 \ libasound2 \ libatk-bridge2.0-0 \ libatk1.0-0 \ libcups2 \ libdbus-1-3 \ libdrm2 \ libgbm1 \ libgdk-pixbuf2.0-0 \ libglib2.0-0 \ libgtk-3-0 \ libnspr4 \ libnss3 \ libx11-xcb1 \ libxcomposite1 \ libxdamage1 \ libxfixes3 \ libxrandr2 \ xdg-utils \ && rm -rf /var/lib/apt/lists/* # Set working directory WORKDIR /app # Copy package files COPY package*.json ./ # Install dependencies RUN npm ci --only=production # Copy application files COPY . . # Create data directory for links storage RUN mkdir -p /app/data # Set environment variables ENV NODE_ENV=production ENV PORT=3000 ENV CHROME_EXECUTABLE_PATH=/usr/bin/chromium # Expose port EXPOSE 3000 # Health check HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ CMD node -e "require('http').get('http://localhost:3000/api/links', (r) => {process.exit(r.statusCode === 200 ? 0 : 1)})" # Start the application CMD ["node", "server.js"]