将镜像用户创建分开。
This commit is contained in:
42
ubuntu2404-qt6-user.dockerfile
Normal file
42
ubuntu2404-qt6-user.dockerfile
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
FROM registry.cn-shenzhen.aliyuncs.com/amass_toolset/ubuntu_dev:24.04-qt6.9.1
|
||||||
|
|
||||||
|
ARG USER_NAME=amass
|
||||||
|
ARG USER_UID=1000
|
||||||
|
ARG USER_GID=100
|
||||||
|
|
||||||
|
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} users; \
|
||||||
|
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/LETwkXKo4m7dqcZ/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}
|
||||||
|
|
||||||
|
RUN sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" \
|
||||||
|
&& git clone --depth=1 https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions \
|
||||||
|
&& git clone --depth=1 https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting \
|
||||||
|
&& git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k \
|
||||||
|
&& sed -i 's/ZSH_THEME=".*"/ZSH_THEME="powerlevel10k\/powerlevel10k"/' ~/.zshrc \
|
||||||
|
&& sed -i 's/plugins=(.*)/plugins=(git z zsh-autosuggestions zsh-syntax-highlighting)/' ~/.zshrc \
|
||||||
|
&& sed -i 's/^setopt share_history/# setopt share_history/' ~/.oh-my-zsh/lib/history.zsh \
|
||||||
|
&& echo 'setopt no_share_history' >> ~/.oh-my-zsh/lib/history.zsh
|
||||||
|
|
||||||
|
USER root
|
||||||
|
CMD ["bash", "-c", "service ssh start && gosu amass code-server --bind-addr 0.0.0.0:8087"]
|
@ -2,10 +2,6 @@ FROM ubuntu:24.04
|
|||||||
LABEL maintainer="amass <168062547@qq.com>"
|
LABEL maintainer="amass <168062547@qq.com>"
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
ARG USER_NAME=amass
|
|
||||||
ARG USER_UID=1000
|
|
||||||
ARG USER_GID=100
|
|
||||||
|
|
||||||
ENV BOOST_VERSION=1_88_0
|
ENV BOOST_VERSION=1_88_0
|
||||||
ENV CODE_VERSION=4.100.3
|
ENV CODE_VERSION=4.100.3
|
||||||
ENV LIBDATACHANNEL_VERSION=0.22.6
|
ENV LIBDATACHANNEL_VERSION=0.22.6
|
||||||
@ -138,31 +134,6 @@ RUN mkdir /var/run/sshd \
|
|||||||
&& sed -i 's/#PubkeyAuthentication yes/PubkeyAuthentication yes/' /etc/ssh/sshd_config
|
&& sed -i 's/#PubkeyAuthentication yes/PubkeyAuthentication yes/' /etc/ssh/sshd_config
|
||||||
EXPOSE 1022
|
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} users; \
|
|
||||||
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/LETwkXKo4m7dqcZ/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}
|
|
||||||
|
|
||||||
RUN sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" \
|
RUN sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" \
|
||||||
&& git clone --depth=1 https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions \
|
&& git clone --depth=1 https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions \
|
||||||
&& git clone --depth=1 https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting \
|
&& git clone --depth=1 https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting \
|
||||||
@ -171,10 +142,9 @@ RUN sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master
|
|||||||
&& sed -i 's/plugins=(.*)/plugins=(git z zsh-autosuggestions zsh-syntax-highlighting)/' ~/.zshrc \
|
&& sed -i 's/plugins=(.*)/plugins=(git z zsh-autosuggestions zsh-syntax-highlighting)/' ~/.zshrc \
|
||||||
&& sed -i 's/^setopt share_history/# setopt share_history/' ~/.oh-my-zsh/lib/history.zsh \
|
&& sed -i 's/^setopt share_history/# setopt share_history/' ~/.oh-my-zsh/lib/history.zsh \
|
||||||
&& echo 'setopt no_share_history' >> ~/.oh-my-zsh/lib/history.zsh
|
&& echo 'setopt no_share_history' >> ~/.oh-my-zsh/lib/history.zsh
|
||||||
|
|
||||||
USER root
|
|
||||||
ENTRYPOINT ["/usr/bin/tini", "--"]
|
ENTRYPOINT ["/usr/bin/tini", "--"]
|
||||||
CMD ["bash", "-c", "service ssh start && gosu amass code-server --bind-addr 0.0.0.0:8087"]
|
CMD ["bash", "-c", "service ssh start && code-server --bind-addr 0.0.0.0:8087"]
|
||||||
# CMD ["bash", "-c", "service ssh start && tail -f /dev/null"]
|
# CMD ["bash", "-c", "service ssh start && tail -f /dev/null"]
|
||||||
# docker build --no-cache --progress=tty -f ubuntu2404.dockerfile -t registry.cn-shenzhen.aliyuncs.com/amass_toolset/ubuntu_dev:24.04 .
|
# docker build --no-cache --progress=tty -f ubuntu2404.dockerfile -t registry.cn-shenzhen.aliyuncs.com/amass_toolset/ubuntu_dev:24.04 .
|
||||||
# docker push registry.cn-shenzhen.aliyuncs.com/amass_toolset/ubuntu_dev:24.04
|
# docker push registry.cn-shenzhen.aliyuncs.com/amass_toolset/ubuntu_dev:24.04
|
Reference in New Issue
Block a user