# Base image with Node.js FROM node:20-buster # Create work directory WORKDIR /app # Install dependencies RUN apt-get update && apt-get install -y \ git \ firefox-esr \ curl \ libx11-xcb1 \ libdbus-glib-1-2 # Clone the repository RUN git clone https://github.com/libredirect/browser_extension # Change to project directory WORKDIR /app/browser_extension # Install npm dependencies RUN npm install # Generate HTML files RUN npm run html # Expose necessary ports EXPOSE 9222 # Add healthcheck HEALTHCHECK --interval=10s --timeout=5s --start-period=30s CMD curl --fail http://127.0.0.1:9222 || exit 1 # Start Firefox and web-ext CMD /usr/bin/firefox-esr --headless --remote-debugging-port=9222 & sleep 5 && npx web-ext run --firefox /usr/bin/firefox-esr --firefox-profile /tmp/firefox-profile --verbose