Skip to content

Commit ad4936f

Browse files
committed
feat: add ubuntu image
1 parent d83395c commit ad4936f

File tree

9 files changed

+87
-1
lines changed

9 files changed

+87
-1
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
./hello
1+
./hello.sh

OS/ubuntu/24.04/Dockerfile

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
FROM ubuntu:latest
2+
3+
COPY /script/startup.sh /usr/start/startup.sh
4+
5+
RUN apt update && \
6+
apt install -y \
7+
net-tools \
8+
iproute2 \
9+
iputils-ping \
10+
curl \
11+
sudo \
12+
wget \
13+
netcat-openbsd \
14+
vim \
15+
openssl \
16+
make \
17+
git && \
18+
mkdir -p /usr/start && \
19+
apt clean
20+
21+
RUN chmod +x /usr/start/startup.sh && \
22+
apt-get update && \
23+
apt-get install -y \
24+
dumb-init \
25+
openssh-client \
26+
openssh-server && \
27+
apt-get clean && \
28+
rm -rf /var/lib/apt/lists/* && \
29+
mkdir -p /run/sshd && \
30+
chmod 755 /run/sshd && \
31+
echo 'AllowTcpForwarding yes' >> /etc/ssh/sshd_config && \
32+
echo 'GatewayPorts yes' >> /etc/ssh/sshd_config && \
33+
echo 'X11Forwarding yes' >> /etc/ssh/sshd_config && \
34+
echo 'Port 22' >> /etc/ssh/sshd_config && \
35+
useradd -m -s /bin/bash devbox && \
36+
usermod -aG sudo devbox && \
37+
echo 'devbox ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers && \
38+
rm -rf /tmp/* && \
39+
mkdir -p /home/devbox/.ssh && \
40+
chown -R devbox:devbox /home/devbox/.ssh && \
41+
chmod -R 770 /home/devbox/.ssh
42+
43+
USER devbox
44+
COPY /OS/debian-ssh/project /home/devbox/project
45+
RUN sudo chown -R devbox:devbox /home/devbox/project && \
46+
sudo chmod -R 777 /home/devbox/project
47+
48+
USER root
49+
50+
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
51+
CMD ["sudo", "-E", "/usr/start/startup.sh"]
52+
53+
WORKDIR /home/devbox/project
54+
EXPOSE 22
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"recommendations": [
3+
"pomdtr.excalidraw-editor",
4+
"editorconfig.editorconfig",
5+
"lokalise.i18n-ally"
6+
]
7+
}

OS/ubuntu/project/entrypoint.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
./hello.sh

OS/ubuntu/project/hello.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
3+
while :; do
4+
{ echo -ne "HTTP/1.1 200 OK\r\nContent-Length: $(echo -n "Hello, World!")\r\n\r\nHello, World!"; } | nc -l -p 8080 -q 1
5+
done

OS/ubuntu/sources.list

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
deb [trusted=yes] http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
2+
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
3+
deb [trusted=yes] http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
4+
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
5+
deb [trusted=yes] http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
6+
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
7+
deb [trusted=yes] http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
8+
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse

OS/ubuntu/update_cn_dockerfile.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
3+
DOCKERFILE=$1
4+
echo "DOCKERFILE: $DOCKERFILE"
5+
TMP_DOCKERFILE="${DOCKERFILE}tmp"
6+
cp $DOCKERFILE $TMP_DOCKERFILE
7+
8+
sed -i '$i\
9+
COPY /OS/ubuntu/sources.list /etc/apt/sources.list' "$TMP_DOCKERFILE"

configs/name.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,4 @@ umi=UmiJS
3131
angular=angular
3232
astro=astro
3333
svelte=SvelteKit
34+
ubuntu=ubuntu

configs/port.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,4 @@ umi=8000
3131
angular=4200
3232
astro=4321
3333
svelte=5173
34+
ubuntu=8080

0 commit comments

Comments
 (0)