diff --git a/README.md b/README.md new file mode 100644 index 0000000..0903919 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# docker-images diff --git a/os/Dockerfile b/os/Dockerfile new file mode 100644 index 0000000..5d490c0 --- /dev/null +++ b/os/Dockerfile @@ -0,0 +1,58 @@ +###################################################### +# ImageName : Operation System Image +# Platform : amd64, arm64 +# Author : Seele.Clover +# Copyright (c) 2024 by GDMU-NA, All Rights Reserved. +###################################################### + +# this Dockerfile is used to build the os image using apt, such as debian/ubuntu/kali-linux, etc. + +ARG SYSTEM_IMAGE +ARG SYSTEM_VERSION +FROM ${SYSTEM_IMAGE}:${SYSTEM_VERSION} as system + +LABEL org.opencontainers.image.name=${SYSTEM_IMAGE} \ + org.opencontainers.image.version=${SYSTEM_VERSION} \ + org.opencontainers.image.licenses="MIT" \ + org.opencontainers.image.maintainer="Seele.Clover" \ + org.opencontainers.image.vendor="GDMU-NA" \ + org.opencontainers.image.repository="https://github.com/gdmuna/docker-images" \ + org.opencontainers.image.url="https://hub.docker.com/r/gdmuna/docker-images" + +EXPOSE 22 +ENV LANG=C.UTF-8 \ + TZ=Asia/Shanghai + +WORKDIR /root + +COPY --chown=root:root ./motd /etc/ +COPY --chown=root:root ./init/* /root/init/ + +RUN export DEBIAN_FRONTEND=noninteractive \ + && apt-get update \ + # allow apt to work with https-based sources + && apt-get install -y --no-install-recommends ca-certificates \ + && chmod +x /root/init/setAptSource.sh \ + # add timezone setting + && apt-get install -y tzdata \ + && echo "${TZ}" > /etc/timezone && ln -sf /usr/share/zoneinfo/${TZ} /etc/localtime \ + && dpkg-reconfigure --frontend noninteractive tzdata \ + # add ssh service + && apt-get install -y --no-install-recommends openssh-server \ + && sed -i "/PermitRootLogin prohibit-password/a\PermitRootLogin yes" /etc/ssh/sshd_config \ + && chmod +x /root/init/setRootPassword.sh \ + # obtain the env of the container itself from 1st process and set it as the env of ssh + && echo '' >> /etc/profile \ + && echo 'export $(cat /proc/1/environ | tr "\\0" "\\n" | xargs)' >> /etc/profile \ + && echo '' >> /root/.bashrc \ + && echo 'source /etc/profile' >> /root/.bashrc \ + # add common tools + && apt-get install -y --no-install-recommends vim \ + && apt-get install -y --no-install-recommends htop \ + && apt-get install -y --no-install-recommends curl wget \ + && apt-get install -y --no-install-recommends iproute2 iputils-ping traceroute \ + # clean up cache + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +CMD ["/bin/bash", "-c", "/etc/init.d/ssh start && tail -f /dev/null"] diff --git a/os/init/setAptSource.sh b/os/init/setAptSource.sh new file mode 100644 index 0000000..c8d92df --- /dev/null +++ b/os/init/setAptSource.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +# ubuntu amd64 +cp -a /etc/apt/sources.list /etc/apt/sources.list.bak \ +# change apt source to ustc +&& sed -i "s@http://.*archive.ubuntu.com@https://mirrors.ustc.edu.cn@g" /etc/apt/sources.list \ +&& sed -i "s@http://.*security.ubuntu.com@https://mirrors.ustc.edu.cn@g" /etc/apt/sources.list \ +&& apt-get update diff --git a/os/init/setRootPassword.sh b/os/init/setRootPassword.sh new file mode 100644 index 0000000..ac7a62f --- /dev/null +++ b/os/init/setRootPassword.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +PASSWORD=$1 +echo "root:$PASSWORD" | chpasswd diff --git a/os/motd b/os/motd new file mode 100644 index 0000000..5584314 --- /dev/null +++ b/os/motd @@ -0,0 +1,17 @@ + +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++ + ++ + ++ ██████ ██████ ███ ███ ██ ██ ███ ██ █████ + ++ ██ ██ ██ ████ ████ ██ ██ ████ ██ ██ ██ + ++ ██ ███ ██ ██ ██ ████ ██ ██ ██ █████ ██ ██ ██ ███████ + ++ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ + ++ ██████ ██████ ██ ██ ██████ ██ ████ ██ ██ + ++ + ++ ==================================================================== + ++ + ++ Welcome to GDMU-NA Cloud Development Platform ! + ++ + ++ + +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +