Update Dockerfile
Browse files- Dockerfile +22 -102
Dockerfile
CHANGED
|
@@ -5,120 +5,40 @@ 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
|
| 9 |
-
RUN
|
| 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
|
| 17 |
-
RUN
|
| 18 |
-
apt-get install -y
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
RUN curl -sL https://deb.nodesource.com/setup_20.x | bash -
|
| 23 |
-
|
| 24 |
-
# Install required packages (excluding tmate since replaced with tailscale)
|
| 25 |
-
RUN apt-get install -y --no-install-recommends \
|
| 26 |
-
nodejs \
|
| 27 |
-
ffmpeg \
|
| 28 |
-
python3 python3-pip python3-venv \
|
| 29 |
-
build-essential \
|
| 30 |
-
openssh-client \
|
| 31 |
-
neofetch \
|
| 32 |
-
git \
|
| 33 |
-
wget \
|
| 34 |
-
vim \
|
| 35 |
-
nano \
|
| 36 |
-
unzip \
|
| 37 |
-
zip \
|
| 38 |
-
htop \
|
| 39 |
-
net-tools \
|
| 40 |
-
iputils-ping \
|
| 41 |
-
dnsutils \
|
| 42 |
-
tmux \
|
| 43 |
-
screen \
|
| 44 |
-
jq \
|
| 45 |
-
ca-certificates \
|
| 46 |
-
software-properties-common \
|
| 47 |
-
sqlite3 \
|
| 48 |
-
libsqlite3-dev \
|
| 49 |
-
libssl-dev \
|
| 50 |
-
libffi-dev \
|
| 51 |
-
libxml2-dev \
|
| 52 |
-
libxslt1-dev \
|
| 53 |
-
libjpeg-dev \
|
| 54 |
-
zlib1g-dev \
|
| 55 |
-
libpng-dev \
|
| 56 |
-
libwebp-dev \
|
| 57 |
-
pkg-config \
|
| 58 |
-
rsync \
|
| 59 |
-
lsof \
|
| 60 |
-
sudo \
|
| 61 |
-
gnupg \
|
| 62 |
-
openssl \
|
| 63 |
-
tree \
|
| 64 |
-
mc \
|
| 65 |
-
python3-dev \
|
| 66 |
-
python3-distutils \
|
| 67 |
-
python3-setuptools \
|
| 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
|
| 77 |
-
pytelegrambotapi \
|
| 78 |
-
requests \
|
| 79 |
-
beautifulsoup4 \
|
| 80 |
-
lxml \
|
| 81 |
-
flask \
|
| 82 |
-
httpx \
|
| 83 |
-
aiohttp \
|
| 84 |
-
schedule
|
| 85 |
|
| 86 |
-
# Install Tailscale
|
| 87 |
-
RUN curl -fsSL https://pkgs.tailscale.com/stable/ubuntu/jammy.gpg |
|
| 88 |
echo "deb [signed-by=/usr/share/keyrings/tailscale-archive-keyring.gpg] https://pkgs.tailscale.com/stable/ubuntu jammy main" | tee /etc/apt/sources.list.d/tailscale.list && \
|
| 89 |
-
apt-get update &&
|
| 90 |
-
apt-get install -y tailscale && \
|
| 91 |
-
apt-get clean && \
|
| 92 |
-
rm -rf /var/lib/apt/lists/*
|
| 93 |
-
|
| 94 |
-
# Generate SSH keys for root (if needed)
|
| 95 |
-
RUN mkdir -p /root/.ssh && \
|
| 96 |
-
ssh-keygen -t rsa -f /root/.ssh/id_rsa -N '' && \
|
| 97 |
-
chmod 700 /root/.ssh && \
|
| 98 |
-
chmod 600 /root/.ssh/id_rsa
|
| 99 |
-
|
| 100 |
-
# Create /dev/ptmx if missing to avoid crashes (permission 666)
|
| 101 |
-
RUN if [ ! -c /dev/ptmx ]; then \
|
| 102 |
-
mknod /dev/ptmx c 5 2 && chmod 666 /dev/ptmx ; \
|
| 103 |
-
fi
|
| 104 |
-
|
| 105 |
-
# Create /dev/pts directory (empty, since mounting devpts is not possible here)
|
| 106 |
-
RUN mkdir -p /dev/pts
|
| 107 |
|
| 108 |
# Prepare /app directory owned by Draco
|
| 109 |
-
RUN mkdir -p /app &&
|
| 110 |
-
echo "Tailscale Session Running..." > /app/index.html && \
|
| 111 |
-
chown -R Draco:Draco /app
|
| 112 |
|
| 113 |
WORKDIR /app
|
| 114 |
-
|
| 115 |
-
# Ensure Draco user can run tailscale (by adding to sudoers and correct PATH)
|
| 116 |
-
# Actually, Draco is already sudoer (NOPASSWD), so can run 'sudo tailscale' easily.
|
| 117 |
-
|
| 118 |
USER Draco
|
| 119 |
|
| 120 |
-
|
| 121 |
-
|
|
|
|
|
|
|
| 122 |
|
| 123 |
-
|
| 124 |
-
|
|
|
|
|
|
|
|
|
| 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 apt-get update && apt-get install -y sudo curl gnupg apt-transport-https && apt-get clean && \
|
| 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 && chown -R Draco:Draco /home/Draco/.npm-global
|
|
|
|
| 14 |
|
| 15 |
+
# Install Node.js 20, ffmpeg, python3, pip and other tools
|
| 16 |
+
RUN curl -sL https://deb.nodesource.com/setup_20.x | bash - && \
|
| 17 |
+
apt-get update && apt-get install -y --no-install-recommends \
|
| 18 |
+
nodejs ffmpeg python3 python3-pip build-essential openssh-client git vim nano unzip zip htop net-tools iputils-ping dnsutils tmux screen jq ca-certificates software-properties-common \
|
| 19 |
+
sqlite3 libsqlite3-dev libssl-dev libffi-dev libxml2-dev libxslt1-dev libjpeg-dev zlib1g-dev libpng-dev libwebp-dev pkg-config rsync lsof sudo gnupg openssl tree mc python3-dev python3-distutils python3-setuptools cron aria2 telnet expect && \
|
| 20 |
+
apt-get clean && rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
# Install Python packages globally
|
| 23 |
+
RUN pip3 install --no-cache-dir pytelegrambotapi requests beautifulsoup4 lxml flask httpx aiohttp schedule
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
+
# Install Tailscale
|
| 26 |
+
RUN curl -fsSL https://pkgs.tailscale.com/stable/ubuntu/jammy.gpg | gpg --dearmor -o /usr/share/keyrings/tailscale-archive-keyring.gpg && \
|
| 27 |
echo "deb [signed-by=/usr/share/keyrings/tailscale-archive-keyring.gpg] https://pkgs.tailscale.com/stable/ubuntu jammy main" | tee /etc/apt/sources.list.d/tailscale.list && \
|
| 28 |
+
apt-get update && apt-get install -y tailscale && apt-get clean && rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
# Prepare /app directory owned by Draco
|
| 31 |
+
RUN mkdir -p /app && echo "Tailscale Session Running..." > /app/index.html && chown -R Draco:Draco /app
|
|
|
|
|
|
|
| 32 |
|
| 33 |
WORKDIR /app
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
USER Draco
|
| 35 |
|
| 36 |
+
EXPOSE 7860
|
| 37 |
+
|
| 38 |
+
# Hardcode your auth key here:
|
| 39 |
+
ENV TAILSCALE_AUTHKEY="tskey-auth-krBh6cJ4GS11CNTRL-Ys653FbsA8VzjZbm7CdD8Vy4C1iCpmh2"
|
| 40 |
|
| 41 |
+
CMD tailscaled --state=/tmp/tailscaled.state --socket=/tmp/tailscaled.sock & \
|
| 42 |
+
sleep 5 && \
|
| 43 |
+
tailscale --socket=/tmp/tailscaled.sock up --authkey=$TAILSCALE_AUTHKEY --accept-routes --accept-dns && \
|
| 44 |
+
python3 -m http.server 7860 && tail -f /dev/null
|