Update Dockerfile
Browse files- Dockerfile +11 -14
Dockerfile
CHANGED
|
@@ -2,7 +2,7 @@ FROM ubuntu:22.04
|
|
| 2 |
|
| 3 |
ENV DEBIAN_FRONTEND=noninteractive
|
| 4 |
|
| 5 |
-
#
|
| 6 |
RUN apt update && apt upgrade -y && \
|
| 7 |
apt install -y \
|
| 8 |
python3 python3-pip \
|
|
@@ -13,32 +13,29 @@ RUN apt update && apt upgrade -y && \
|
|
| 13 |
git \
|
| 14 |
curl \
|
| 15 |
procps \
|
| 16 |
-
ca-certificates \
|
| 17 |
-
passwd \
|
| 18 |
-
libpam-runtime && \
|
| 19 |
apt clean && rm -rf /var/lib/apt/lists/*
|
| 20 |
|
| 21 |
-
#
|
| 22 |
-
RUN
|
| 23 |
-
|
| 24 |
|
| 25 |
-
#
|
| 26 |
RUN mkdir -p /root/.ssh && \
|
| 27 |
ssh-keygen -t rsa -f /root/.ssh/id_rsa -N '' && \
|
| 28 |
chmod 700 /root/.ssh && chmod 600 /root/.ssh/id_rsa
|
| 29 |
|
| 30 |
-
#
|
| 31 |
RUN pip3 install --no-cache-dir pytelegrambotapi
|
| 32 |
|
| 33 |
-
#
|
| 34 |
RUN mkdir -p /app && echo "Tmate Session Running..." > /app/index.html
|
| 35 |
-
|
| 36 |
WORKDIR /app
|
| 37 |
|
| 38 |
EXPOSE 7860
|
| 39 |
|
| 40 |
-
#
|
| 41 |
USER draco
|
| 42 |
|
| 43 |
-
#
|
| 44 |
-
CMD bash -c "tmate -F & python3 -m http.server 7860 &
|
|
|
|
| 2 |
|
| 3 |
ENV DEBIAN_FRONTEND=noninteractive
|
| 4 |
|
| 5 |
+
# Install dependencies
|
| 6 |
RUN apt update && apt upgrade -y && \
|
| 7 |
apt install -y \
|
| 8 |
python3 python3-pip \
|
|
|
|
| 13 |
git \
|
| 14 |
curl \
|
| 15 |
procps \
|
| 16 |
+
ca-certificates && \
|
|
|
|
|
|
|
| 17 |
apt clean && rm -rf /var/lib/apt/lists/*
|
| 18 |
|
| 19 |
+
# Create user 'draco' with UID 0 (root), no password, with extra groups
|
| 20 |
+
RUN groupadd -f docker && \
|
| 21 |
+
useradd -m -u 0 -o -s /bin/bash -G adm,staff,audio,video,docker draco
|
| 22 |
|
| 23 |
+
# Generate SSH key for tmate (stored in root's home, which draco owns as UID 0)
|
| 24 |
RUN mkdir -p /root/.ssh && \
|
| 25 |
ssh-keygen -t rsa -f /root/.ssh/id_rsa -N '' && \
|
| 26 |
chmod 700 /root/.ssh && chmod 600 /root/.ssh/id_rsa
|
| 27 |
|
| 28 |
+
# Install Python Telegram Bot library
|
| 29 |
RUN pip3 install --no-cache-dir pytelegrambotapi
|
| 30 |
|
| 31 |
+
# Setup application directory
|
| 32 |
RUN mkdir -p /app && echo "Tmate Session Running..." > /app/index.html
|
|
|
|
| 33 |
WORKDIR /app
|
| 34 |
|
| 35 |
EXPOSE 7860
|
| 36 |
|
| 37 |
+
# Switch to draco user (UID 0)
|
| 38 |
USER draco
|
| 39 |
|
| 40 |
+
# Start tmate and python server, log everything to container stdout
|
| 41 |
+
CMD bash -c "tmate -F & python3 -m http.server 7860 & wait"
|