dracoox commited on
Commit
5343637
·
verified ·
1 Parent(s): 47af400

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +9 -9
Dockerfile CHANGED
@@ -2,7 +2,7 @@ FROM ubuntu:22.04
2
 
3
  ENV DEBIAN_FRONTEND=noninteractive LANG=en_US.UTF-8
4
 
5
- # Install required packages including desktop, Node.js, tools
6
  RUN apt update && apt upgrade -y && \
7
  apt install -y \
8
  sudo \
@@ -39,29 +39,28 @@ RUN apt update && apt upgrade -y && \
39
  locale-gen en_US.UTF-8 && \
40
  apt clean && rm -rf /var/lib/apt/lists/*
41
 
42
- # Configure XRDP to use LXDE
43
  RUN echo "lxsession -s LXDE -e LXDE" > /etc/xrdp/startwm.sh && chmod +x /etc/xrdp/startwm.sh
44
 
45
  # Install Node.js v22
46
  RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - && \
47
- apt update && apt install -y nodejs && \
48
- npm install -g npm && \
49
  apt clean && rm -rf /var/lib/apt/lists/*
50
 
51
  # Install speedtest-cli
52
  RUN pip3 install --no-cache-dir speedtest-cli
53
 
54
- # Create user 'draco' with sudo rights and fixed UID
55
  RUN useradd -m -s /bin/bash -u 1000 draco && \
56
  echo "draco:draco" | chpasswd && \
57
  usermod -aG sudo draco
58
 
59
- # Setup SSH keys for draco user
60
  RUN mkdir -p /home/draco/.ssh && \
61
  ssh-keygen -t rsa -f /home/draco/.ssh/id_rsa -N '' && \
62
  chown -R draco:draco /home/draco/.ssh
63
 
64
- # Create reconnecting tmate launcher (⚠️ NO INDENTATION inside heredoc!)
65
  RUN cat << 'EOF' > /home/draco/run_tmate.sh
66
  #!/bin/bash
67
  while true; do
@@ -79,14 +78,15 @@ sleep 5
79
  done
80
  EOF
81
 
 
82
  RUN chmod +x /home/draco/run_tmate.sh && chown draco:draco /home/draco/run_tmate.sh
83
 
84
  # Switch to draco user
85
  USER draco
86
  WORKDIR /home/draco
87
 
88
- # Expose ports: XRDP and HTTP
89
  EXPOSE 3389 7890
90
 
91
- # Start tmate reconnect loop and HTTP server
92
  CMD bash -c "/home/draco/run_tmate.sh & python3 -m http.server 7890"
 
2
 
3
  ENV DEBIAN_FRONTEND=noninteractive LANG=en_US.UTF-8
4
 
5
+ # Install packages and desktop + XRDP
6
  RUN apt update && apt upgrade -y && \
7
  apt install -y \
8
  sudo \
 
39
  locale-gen en_US.UTF-8 && \
40
  apt clean && rm -rf /var/lib/apt/lists/*
41
 
42
+ # Set LXDE as XRDP default session
43
  RUN echo "lxsession -s LXDE -e LXDE" > /etc/xrdp/startwm.sh && chmod +x /etc/xrdp/startwm.sh
44
 
45
  # Install Node.js v22
46
  RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - && \
47
+ apt update && apt install -y nodejs && npm install -g npm && \
 
48
  apt clean && rm -rf /var/lib/apt/lists/*
49
 
50
  # Install speedtest-cli
51
  RUN pip3 install --no-cache-dir speedtest-cli
52
 
53
+ # Create 'draco' user with sudo and UID 1000
54
  RUN useradd -m -s /bin/bash -u 1000 draco && \
55
  echo "draco:draco" | chpasswd && \
56
  usermod -aG sudo draco
57
 
58
+ # Setup SSH keys for 'draco'
59
  RUN mkdir -p /home/draco/.ssh && \
60
  ssh-keygen -t rsa -f /home/draco/.ssh/id_rsa -N '' && \
61
  chown -R draco:draco /home/draco/.ssh
62
 
63
+ # Add tmate auto-reconnect launcher (NO INDENTATION HERE!)
64
  RUN cat << 'EOF' > /home/draco/run_tmate.sh
65
  #!/bin/bash
66
  while true; do
 
78
  done
79
  EOF
80
 
81
+ # Set permissions
82
  RUN chmod +x /home/draco/run_tmate.sh && chown draco:draco /home/draco/run_tmate.sh
83
 
84
  # Switch to draco user
85
  USER draco
86
  WORKDIR /home/draco
87
 
88
+ # Expose XRDP + HTTP server ports
89
  EXPOSE 3389 7890
90
 
91
+ # Run tmate auto-reconnect and simple HTTP server
92
  CMD bash -c "/home/draco/run_tmate.sh & python3 -m http.server 7890"