File size: 1,957 Bytes
904b797
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8f6f133
904b797
 
8f6f133
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# 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 [email protected]

# 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"]