将镜像用户创建分开。
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"]
|
Reference in New Issue
Block a user