Files
Dockerfiles/ubuntu2404-qt6-user.dockerfile
2025-06-26 10:12:09 +00:00

51 lines
2.5 KiB
Docker

FROM registry.cn-shenzhen.aliyuncs.com/amass_law/ubuntu_dev:24.04-qt6.9.1
ARG USER_NAME=amass
ARG GROUP_NAME=amass
ARG USER_UID=1000
ARG USER_GID=100
ARG DOCKER_GID=281
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; \
if ! getent group ${DOCKER_GID} >/dev/null; then \
groupadd -g ${DOCKER_GID} docker; \
fi; \
useradd -u ${USER_UID} -g ${USER_GID} -m -s /bin/zsh ${USER_NAME}; \
usermod -aG sudo ${USER_NAME}; \
usermod -aG docker ${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"]
# docker build --no-cache --progress=tty -f ubuntu2404-qt6-user.dockerfile -t registry.cn-shenzhen.aliyuncs.com/amass_law/ubuntu_dev:24.04-qt6.9.1-user .
# docker push registry.cn-shenzhen.aliyuncs.com/amass_law/ubuntu_dev:24.04-qt6.9.1-user