Skip to content

Commit abeba24

Browse files
committed
initial commit
0 parents  commit abeba24

File tree

20 files changed

+488
-0
lines changed

20 files changed

+488
-0
lines changed

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# docker-baseimage
2+
3+
base 镜像:
4+
- 使用 s6 进程管理工具。使用 [skaware](https://github.com/just-containers/skaware) 容器化编译 s6
5+
- 使用 sshd
6+
7+
java 镜像:
8+
- 支持 jvm-sandbox 插件,通过环境变量启动
9+
10+
## Reference
11+
- https://github.com/jprjr/docker-ubuntu-stack/tree/master
12+
- https://github.com/jprjr/docker-debian-stack/blob/base-wheezy/base/Dockerfile
13+
- https://web.archive.org/web/20160304021857/http://blog.tutum.co/2014/12/02/docker-and-s6-my-new-favorite-process-supervisor/
14+
- https://www.brendangregg.com/blog/2016-07-13/llnode-nodejs-memory-leak-analysis.html
15+
- https://developer.ibm.com/articles/explore-nodejs-core-dumps-using-the-llnode-plugin-for-lldb/

base/Dockerfile.almalinux

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
FROM almalinux/8-init:8.8-20230718
2+
3+
LABEL authors="gang.liu"
4+
5+
RUN dnf install -y \
6+
tzdata \
7+
lsof \
8+
net-tools \
9+
iproute \
10+
curl \
11+
tcpdump \
12+
openssl \
13+
vim \
14+
bash-completion \
15+
wget \
16+
psmisc \
17+
procps \
18+
iotop \
19+
htop \
20+
ca-certificates \
21+
;
22+
23+
# Minimize the systemd setup
24+
# ref: https://github.com/freeipa/freeipa-container/blob/master/Dockerfile.almalinux-8#L26
25+
RUN find /etc/systemd/system /usr/lib/systemd/system/{basic,multi-user,sysinit}.target.wants -type l \! -lname /dev/null | xargs rm -v
26+
RUN systemctl mask systemd-logind.service && mv /usr/lib/systemd/system/systemd-logind.service /usr/lib/systemd/system/systemd-logind.service-disable-dbus
27+
28+
ENTRYPOINT [ "/usr/sbin/init" ]

base/Dockerfile.almalinux-s6

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
FROM almalinux:8.8-20230718
2+
3+
LABEL authors="gang.liu"
4+
5+
RUN rpm --import https://repo.almalinux.org/almalinux/RPM-GPG-KEY-AlmaLinux \
6+
&& dnf install -y \
7+
passwd \
8+
tzdata \
9+
lsof \
10+
net-tools \
11+
iproute \
12+
curl \
13+
tcpdump \
14+
openssl \
15+
vim \
16+
bash-completion \
17+
wget \
18+
psmisc \
19+
procps \
20+
iotop \
21+
ca-certificates \
22+
openssh \
23+
openssh-server \
24+
epel-release.noarch \
25+
unzip \
26+
&& dnf update -y;
27+
28+
COPY root/ /root/
29+
COPY etc/ /etc
30+
31+
# ssh
32+
ADD https://raw.githubusercontent.com/fedora-sysv/initscripts/main/etc/rc.d/init.d/functions /etc/rc.d/init.d/
33+
ADD https://raw.githubusercontent.com/OpenMandrivaAssociation/openssh/master/sshd-keygen /usr/sbin/
34+
RUN chmod +x /usr/sbin/sshd-keygen \
35+
&& sshd-keygen \
36+
&& sed -i 's/GSSAPIAuthentication yes/GSSAPIAuthentication no/g' /etc/ssh/sshd_config \
37+
&& sed -i 's/UseDNS yes/UseDNS no/g' /etc/ssh/sshd_config \
38+
&& echo test@2024ABC | passwd --stdin root
39+
40+
# jvm-sandbox
41+
RUN wget https://ompc.oss-cn-hangzhou.aliyuncs.com/jvm-sandbox/release/sandbox-1.3.3-bin.zip && unzip sandbox-1.3.3-bin.zip -d /opt/sandbox
42+
43+
# install s6
44+
RUN mkdir -p /s6
45+
ADD root/s6-2.11.0.0-linux-x86-bin.tar.gz /s6
46+
RUN cp /s6/bin/* /usr/bin/
47+
48+
ENTRYPOINT ["/usr/bin/s6-svscan","/etc/s6"]

base/Dockerfile.centos

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
FROM centos:centos7.9.2009
2+
3+
ARG VERSION
4+
5+
RUN yum install -y \
6+
tzdata \
7+
lsof \
8+
vim \
9+
telnet \
10+
net-tools \
11+
iproute \
12+
curl \
13+
tcpdump \
14+
openssl \
15+
ca-certificates \
16+
;
17+
18+
# s6 overlay
19+
ADD https://github.com/just-containers/s6-overlay/releases/download/v2.2.0.1/s6-overlay-amd64-installer /tmp/
20+
RUN chmod +x /tmp/s6-overlay-amd64-installer && /tmp/s6-overlay-amd64-installer /
21+
22+
ENTRYPOINT ["/init"]
23+
CMD ["python2.7", "-m", "SimpleHTTPServer", "8080"]

base/Dockerfile.centos-s6

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
FROM centos:centos7.9.2009
2+
3+
ARG VERSION
4+
5+
RUN yum install -y \
6+
tzdata \
7+
lsof \
8+
vim \
9+
bash-completion \
10+
telnet \
11+
wget \
12+
net-tools \
13+
iproute \
14+
curl \
15+
tcpdump \
16+
openssl \
17+
ca-certificates \
18+
openssh \
19+
openssh-server \
20+
procps \
21+
psmisc \
22+
unzip \
23+
;
24+
25+
COPY root/ /root/
26+
COPY etc/ /etc
27+
28+
# ssh
29+
ADD https://raw.githubusercontent.com/fedora-sysv/initscripts/main/etc/rc.d/init.d/functions /etc/rc.d/init.d/
30+
ADD https://raw.githubusercontent.com/OpenMandrivaAssociation/openssh/master/sshd-keygen /usr/sbin/
31+
RUN chmod +x /usr/sbin/sshd-keygen \
32+
&& sshd-keygen \
33+
&& sed -i 's/GSSAPIAuthentication yes/GSSAPIAuthentication no/g' /etc/ssh/sshd_config \
34+
&& sed -i 's/UseDNS yes/UseDNS no/g' /etc/ssh/sshd_config \
35+
&& echo test@2024ABC | passwd --stdin root
36+
37+
# jvm-sandbox
38+
RUN wget https://ompc.oss-cn-hangzhou.aliyuncs.com/jvm-sandbox/release/sandbox-1.3.3-bin.zip && unzip sandbox-1.3.3-bin.zip -d /opt/sandbox
39+
40+
# install s6
41+
RUN mkdir -p /s6
42+
ADD root/s6-2.11.0.0-linux-x86-bin.tar.gz /s6
43+
RUN cp /s6/bin/* /usr/bin/
44+
45+
ENTRYPOINT ["/usr/bin/s6-svscan","/etc/s6"]

base/Dockerfile.debian

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
FROM debian:bullseye
2+
3+
ARG VERSION
4+
5+
LABEL version="1.0"
6+
LABEL maintainer="gang.liu"
7+
8+
RUN apt-get install -y \
9+
tzdata \
10+
lsof \
11+
vim \
12+
telnet \
13+
net-tools \
14+
iproute \
15+
curl \
16+
tcpdump \
17+
openssl \
18+
ca-certificates \
19+
dumb-init \
20+
;
21+
22+
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
23+
24+
CMD ["python2.7", "-m", "SimpleHTTPServer", "8080"]

base/etc/s6/.s6-svscan/SIGINT

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env bash
2+
3+
exit 0

base/etc/s6/.s6-svscan/SIGWINCH

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env bash
2+
3+
for service in /etc/s6/*
4+
do
5+
s6-svwait -d $service
6+
done

base/etc/s6/.s6-svscan/finish

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env bash
2+
3+
for service in /etc/s6/*
4+
do
5+
s6-svwait -d $service
6+
done

base/etc/s6/app/finish

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env bash
2+
3+
#If ./finish exits 125, then s6-supervise sends a 'O' event to ./event before the 'D', and it does not restart the service
4+
exit 125

0 commit comments

Comments
 (0)