# Use the base image for Chrome web version FROM devmotoemoto47ark123/chrome-webversion-fast-run:latest # Set environment variables ENV PORT=9870 # Switch to the pre-created user USER 1000 # Set home to the user's home directory ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH # Set the working directory to the user's home directory WORKDIR $HOME/app # Create a directory for supervisord logs in the user's home directory RUN mkdir -p $HOME/app/logs && \ chmod -R 777 $HOME/app/logs # Create supervisord configuration file with proper permissions USER root RUN echo "[supervisord]\n\ logfile=/home/user/app/logs/supervisord.log\n\ logfile_maxbytes=50MB\n\ logfile_backups=10\n\ loglevel=info\n\ pidfile=/home/user/app/logs/supervisord.pid\n\ \n\ [program:chrome-webversion]\n\ command=google-chrome-stable --no-sandbox --headless --disable-gpu --remote-debugging-port=9870 --remote-debugging-address=0.0.0.0 --user-data-dir=/data\n\ stdout_logfile=/home/user/app/logs/chrome-webversion.log\n\ stderr_logfile=/home/user/app/logs/chrome-webversion_err.log\n" \ > /etc/supervisord.conf # Switch back to the user USER 1000 # Expose the port EXPOSE 9870 # Start supervisord with the custom configuration CMD ["supervisord", "-c", "/etc/supervisord.conf"]