Upload Dockerfile
Browse files- Dockerfile +86 -0
Dockerfile
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM ubuntu:22.04
|
| 2 |
+
|
| 3 |
+
ENV DEBIAN_FRONTEND=noninteractive
|
| 4 |
+
ENV TERM=xterm-256color
|
| 5 |
+
|
| 6 |
+
# -------------------------
|
| 7 |
+
# Base packages
|
| 8 |
+
# -------------------------
|
| 9 |
+
RUN apt-get update && apt-get install -y \
|
| 10 |
+
bash \
|
| 11 |
+
curl \
|
| 12 |
+
wget \
|
| 13 |
+
git \
|
| 14 |
+
nano \
|
| 15 |
+
vim \
|
| 16 |
+
htop \
|
| 17 |
+
ca-certificates \
|
| 18 |
+
sudo \
|
| 19 |
+
gnupg \
|
| 20 |
+
lsb-release \
|
| 21 |
+
unzip \
|
| 22 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 23 |
+
|
| 24 |
+
# -------------------------
|
| 25 |
+
# Python
|
| 26 |
+
# -------------------------
|
| 27 |
+
RUN apt-get update && apt-get install -y \
|
| 28 |
+
python3 \
|
| 29 |
+
python3-pip \
|
| 30 |
+
python3-venv \
|
| 31 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 32 |
+
|
| 33 |
+
# -------------------------
|
| 34 |
+
# Node.js (LTS)
|
| 35 |
+
# -------------------------
|
| 36 |
+
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
|
| 37 |
+
&& apt-get install -y nodejs
|
| 38 |
+
|
| 39 |
+
# -------------------------
|
| 40 |
+
# Go
|
| 41 |
+
# -------------------------
|
| 42 |
+
RUN wget https://go.dev/dl/go1.22.0.linux-amd64.tar.gz \
|
| 43 |
+
&& tar -C /usr/local -xzf go1.22.0.linux-amd64.tar.gz \
|
| 44 |
+
&& rm go1.22.0.linux-amd64.tar.gz
|
| 45 |
+
|
| 46 |
+
ENV PATH="/usr/local/go/bin:${PATH}"
|
| 47 |
+
|
| 48 |
+
# -------------------------
|
| 49 |
+
# Docker CLI (NO daemon)
|
| 50 |
+
# -------------------------
|
| 51 |
+
RUN curl -fsSL https://get.docker.com | sh \
|
| 52 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 53 |
+
|
| 54 |
+
# -------------------------
|
| 55 |
+
# Install ttyd
|
| 56 |
+
# -------------------------
|
| 57 |
+
RUN wget https://github.com/tsl0922/ttyd/releases/download/1.7.7/ttyd.x86_64 \
|
| 58 |
+
-O /usr/local/bin/ttyd \
|
| 59 |
+
&& chmod +x /usr/local/bin/ttyd
|
| 60 |
+
|
| 61 |
+
# -------------------------
|
| 62 |
+
# User (ephemeral session)
|
| 63 |
+
# -------------------------
|
| 64 |
+
RUN useradd -m terminal \
|
| 65 |
+
&& echo "terminal ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
|
| 66 |
+
|
| 67 |
+
# -------------------------
|
| 68 |
+
# Welcome banner
|
| 69 |
+
# -------------------------
|
| 70 |
+
COPY banner.txt /etc/banner.txt
|
| 71 |
+
|
| 72 |
+
RUN echo 'cat /etc/banner.txt' >> /etc/bash.bashrc && \
|
| 73 |
+
echo 'cd /tmp' >> /etc/bash.bashrc
|
| 74 |
+
|
| 75 |
+
# -------------------------
|
| 76 |
+
# Session cleanup on exit
|
| 77 |
+
# -------------------------
|
| 78 |
+
RUN echo 'rm -rf /tmp/*' >> /etc/bash.bashrc
|
| 79 |
+
|
| 80 |
+
USER terminal
|
| 81 |
+
WORKDIR /tmp
|
| 82 |
+
|
| 83 |
+
EXPOSE 7860
|
| 84 |
+
|
| 85 |
+
# -W = close session when browser disconnects
|
| 86 |
+
CMD ["ttyd", "-p", "7860", "-W", "bash"]
|