添加镜像构建文件。

This commit is contained in:
amass 2025-03-28 23:33:54 +08:00
parent b50caa85b0
commit 09a746511d
2 changed files with 58 additions and 1 deletions

55
ubuntu1804.dockerfile Normal file
View File

@ -0,0 +1,55 @@
FROM ubuntu:18.04
LABEL maintainer="amass <168062547@qq.com>"
ENV DEBIAN_FRONTEND=noninteractive
ARG USER_NAME=amass
ARG USER_UID=1000
ARG GROUP_NAME=amass
ARG USER_GID=1000
RUN apt update \
&& apt install -y gcc g++ gdb cmake ninja-build pkg-config openssh-server git nano gpg ca-certificates \
wget curl rsync lsb-release ubuntu-keyring gnupg2 libssl-dev zlib1g-dev gettext jq bzip2 unzip xz-utils \
bc cpio dosfstools mtools tree htop sudo gosu \
&& wget https://github.com/krallin/tini/releases/download/v0.19.0/tini-amd64 -O /usr/bin/tini \
&& chmod +x /usr/bin/tini \
&& apt clean \
&& rm -fr /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN mkdir /var/run/sshd \
&& sed -i 's/#Port 22/Port 1022/' /etc/ssh/sshd_config \
&& sed -i 's/#PubkeyAuthentication yes/PubkeyAuthentication yes/' /etc/ssh/sshd_config
EXPOSE 1022
RUN set -eux; \
if getent passwd ${USER_UID} >/dev/null; then \
OLD_USER=$(getent passwd ${USER_UID} | cut -d: -f1); \
userdel -rf "$OLD_USER" || true; \
fi; \
if ! getent group ${USER_GID} >/dev/null; then \
groupadd -g ${USER_GID} ${GROUP_NAME}; \
fi; \
useradd -u ${USER_UID} -g ${USER_GID} -m -s /bin/zsh ${USER_NAME}; \
usermod -aG sudo ${USER_NAME}; \
echo "${USER_NAME} ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
RUN mkdir -p /home/${USER_NAME}/.ssh \
&& chown ${USER_UID}:${USER_GID} /home/${USER_NAME}/.ssh \
&& chmod 700 /home/${USER_NAME}/.ssh \
&& wget https://cloud.amass.fun/s/Z42BPTsfjB53k35/download -O /home/${USER_NAME}/.ssh/authorized_keys \
&& chown ${USER_UID}:${USER_GID} /home/${USER_NAME}/.ssh/authorized_keys \
&& chmod 600 /home/${USER_NAME}/.ssh/authorized_keys
USER ${USER_NAME}
RUN git config --global core.quotepath false \
&& git config --global user.email "168062547@qq.com" \
&& git config --global user.name ${USER_NAME}
USER root
ENTRYPOINT ["/usr/bin/tini", "--"]
CMD ["bash", "-c", "service ssh start && tail -f /dev/null"]
# docker build --no-cache --progress=tty -f ubuntu1804.dockerfile -t registry.cn-shenzhen.aliyuncs.com/amass_toolset/ubuntu_dev:18.04 .
# docker push registry.cn-shenzhen.aliyuncs.com/amass_toolset/ubuntu_dev:18.04

View File

@ -122,8 +122,10 @@ RUN cd /root \
&& cmake --build build --target all \
&& cmake --install build \
&& rm -fr /root/ZLMediaKit \
&& echo "export LD_LIBRARY_PATH=/opt/Libraries/ZLMediaKit/lib:$LD_LIBRARY_PATH" >> /etc/profile
&& echo 'export PATH=/opt/Libraries/ZLMediaKit/bin:$PATH' >> /etc/profile \
&& echo 'export LD_LIBRARY_PATH=/opt/Libraries/ZLMediaKit/lib:$LD_LIBRARY_PATH' >> /etc/profile
ENV LD_LIBRARY_PATH=/opt/Libraries/ZLMediaKit/lib:$LD_LIBRARY_PATH
ENV PATH=/opt/Libraries/ZLMediaKit/bin:$PATH
ENV LANG=C.UTF-8
ENV LC_ALL=C.UTF-8