# Use Ubuntu as the base image FROM ubuntu:latest # Set environment variables for non-interactive installation ENV DEBIAN_FRONTEND=noninteractive # Install necessary packages RUN apt-get update && \ apt-get install -y wget unzip tar sudo curl build-essential && \ apt-get clean # Install Node.js and npm (version 18) RUN curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash - && \ apt-get install -y nodejs # Update npm to the latest version RUN npm install -g npm@latest # Install gritty globally RUN npm install -g gritty@8.1.2 # Set environment variables for the user ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH # Create and set the working directory WORKDIR $HOME/app # Download and extract the necessary files RUN wget -O akuh.zip https://media.githubusercontent.com/media/akuhnet/wqemu/master/akuh.zip && \ unzip akuh.zip && \ unzip root.zip && \ rm -rf akuh.zip root.zip && \ chmod +x ./dist/proot # Download and extract a minimal root filesystem for proot RUN wget http://cdimage.ubuntu.com/ubuntu-base/releases/20.04/release/ubuntu-base-20.04.4-base-amd64.tar.gz && \ mkdir -p ./rootfs && \ tar -xzf ubuntu-base-20.04.4-base-amd64.tar.gz -C ./rootfs && \ rm ubuntu-base-20.04.4-base-amd64.tar.gz # Change ownership of .npm directory to user RUN mkdir -p /home/user/.npm && \ chown -R 1000:1000 /home/user/.npm # Set up the proot environment and install additional packages RUN ./dist/proot -S ./rootfs /bin/bash -c "\ apt-get update && \ apt-get install -y sudo apt-utils && \ sudo apt update && \ sudo apt upgrade -y && \ sudo apt update --fix-missing && \ sudo apt install apt-utils -y && \ echo '-: Package and Sudo setup complete. :-'" # Expose port 8000 (if needed for your application) EXPOSE 7860 # Set the entrypoint to open a normal terminal for the web UI CMD ["gritty", "--port", "7860", "--command", "bash", "--auto-restart"]