Update Dockerfile
Browse files- Dockerfile +33 -28
Dockerfile
CHANGED
|
@@ -5,23 +5,28 @@ ENV TERM=xterm-256color
|
|
| 5 |
ENV NPM_CONFIG_PREFIX=/home/Draco/.npm-global
|
| 6 |
ENV PATH=$PATH:/home/Draco/.npm-global/bin
|
| 7 |
|
| 8 |
-
# Create user Draco with passwordless sudo
|
| 9 |
RUN mkdir -p /etc/sudoers.d && \
|
| 10 |
useradd -m -u 1000 -s /bin/bash Draco && \
|
| 11 |
echo "Draco ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/draco && \
|
| 12 |
chmod 440 /etc/sudoers.d/draco && \
|
| 13 |
-
mkdir -p /home/Draco/.npm-global &&
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
-
# Install curl, gnupg, and NodeSource repo
|
| 16 |
-
RUN apt-get update && apt-get install -y curl gnupg && apt-get clean
|
| 17 |
RUN curl -sL https://deb.nodesource.com/setup_20.x | bash -
|
| 18 |
|
| 19 |
-
# Install
|
| 20 |
-
RUN apt-get
|
| 21 |
nodejs \
|
| 22 |
ffmpeg \
|
| 23 |
python3 python3-pip python3-venv \
|
| 24 |
build-essential \
|
|
|
|
| 25 |
openssh-client \
|
| 26 |
neofetch \
|
| 27 |
git \
|
|
@@ -63,9 +68,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
| 63 |
cron \
|
| 64 |
aria2 \
|
| 65 |
telnet \
|
| 66 |
-
expect \
|
| 67 |
-
|
| 68 |
-
|
| 69 |
|
| 70 |
# Install Python packages globally
|
| 71 |
RUN pip3 install --no-cache-dir \
|
|
@@ -78,16 +83,23 @@ RUN pip3 install --no-cache-dir \
|
|
| 78 |
aiohttp \
|
| 79 |
schedule
|
| 80 |
|
| 81 |
-
#
|
| 82 |
-
RUN
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
|
|
|
|
|
|
|
|
|
| 88 |
|
| 89 |
-
#
|
| 90 |
-
RUN mkdir -p /
|
|
|
|
|
|
|
|
|
|
|
|
|
| 91 |
chown -R Draco:Draco /app
|
| 92 |
|
| 93 |
WORKDIR /app
|
|
@@ -95,15 +107,8 @@ WORKDIR /app
|
|
| 95 |
# Switch to Draco user
|
| 96 |
USER Draco
|
| 97 |
|
| 98 |
-
# Verify important versions
|
| 99 |
RUN node -v && npm -v && python3 --version && ffmpeg -version
|
| 100 |
|
| 101 |
-
#
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
# Start HTTP server and tailscaled with wait loop
|
| 105 |
-
CMD python3 -m http.server 7860 & \
|
| 106 |
-
tailscaled --tun=userspace-networking --socks5-server=localhost:1055 > /dev/null 2>&1 & \
|
| 107 |
-
while ! tailscale up --ssh --netfilter-mode=off; do \
|
| 108 |
-
echo "Waiting for tailscaled..."; sleep 1; \
|
| 109 |
-
done
|
|
|
|
| 5 |
ENV NPM_CONFIG_PREFIX=/home/Draco/.npm-global
|
| 6 |
ENV PATH=$PATH:/home/Draco/.npm-global/bin
|
| 7 |
|
| 8 |
+
# Create sudoers.d directory, user Draco with passwordless sudo and npm global folder
|
| 9 |
RUN mkdir -p /etc/sudoers.d && \
|
| 10 |
useradd -m -u 1000 -s /bin/bash Draco && \
|
| 11 |
echo "Draco ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/draco && \
|
| 12 |
chmod 440 /etc/sudoers.d/draco && \
|
| 13 |
+
mkdir -p /home/Draco/.npm-global && \
|
| 14 |
+
chown -R Draco:Draco /home/Draco/.npm-global
|
| 15 |
+
|
| 16 |
+
# Install curl, gnupg, and add NodeSource Node.js 20 repo
|
| 17 |
+
RUN apt-get update && \
|
| 18 |
+
apt-get install -y curl gnupg && \
|
| 19 |
+
apt-get clean
|
| 20 |
|
|
|
|
|
|
|
| 21 |
RUN curl -sL https://deb.nodesource.com/setup_20.x | bash -
|
| 22 |
|
| 23 |
+
# Install Node.js 20, ffmpeg, and required packages
|
| 24 |
+
RUN apt-get install -y --no-install-recommends \
|
| 25 |
nodejs \
|
| 26 |
ffmpeg \
|
| 27 |
python3 python3-pip python3-venv \
|
| 28 |
build-essential \
|
| 29 |
+
tmate \
|
| 30 |
openssh-client \
|
| 31 |
neofetch \
|
| 32 |
git \
|
|
|
|
| 68 |
cron \
|
| 69 |
aria2 \
|
| 70 |
telnet \
|
| 71 |
+
expect && \
|
| 72 |
+
apt-get clean && \
|
| 73 |
+
rm -rf /var/lib/apt/lists/*
|
| 74 |
|
| 75 |
# Install Python packages globally
|
| 76 |
RUN pip3 install --no-cache-dir \
|
|
|
|
| 83 |
aiohttp \
|
| 84 |
schedule
|
| 85 |
|
| 86 |
+
# Generate SSH keys for tmate (root)
|
| 87 |
+
RUN mkdir -p /root/.ssh && \
|
| 88 |
+
ssh-keygen -t rsa -f /root/.ssh/id_rsa -N '' && \
|
| 89 |
+
chmod 700 /root/.ssh && \
|
| 90 |
+
chmod 600 /root/.ssh/id_rsa
|
| 91 |
+
|
| 92 |
+
# Create /dev/ptmx if missing to avoid crashes (permission 666)
|
| 93 |
+
RUN if [ ! -c /dev/ptmx ]; then \
|
| 94 |
+
mknod /dev/ptmx c 5 2 && chmod 666 /dev/ptmx ; \
|
| 95 |
+
fi
|
| 96 |
|
| 97 |
+
# Create /dev/pts directory (empty, since mounting devpts is not possible here)
|
| 98 |
+
RUN mkdir -p /dev/pts
|
| 99 |
+
|
| 100 |
+
# Prepare /app directory owned by Draco
|
| 101 |
+
RUN mkdir -p /app && \
|
| 102 |
+
echo "Tmate Session Running..." > /app/index.html && \
|
| 103 |
chown -R Draco:Draco /app
|
| 104 |
|
| 105 |
WORKDIR /app
|
|
|
|
| 107 |
# Switch to Draco user
|
| 108 |
USER Draco
|
| 109 |
|
| 110 |
+
# Verify important versions (optional)
|
| 111 |
RUN node -v && npm -v && python3 --version && ffmpeg -version
|
| 112 |
|
| 113 |
+
# Use tmate -F foreground, no background, ignore terminal errors to avoid crash
|
| 114 |
+
CMD python3 -m http.server 7860 & tmate -F || echo "tmate exited or failed"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|