Skip to content

Commit

Permalink
zsh and prezto
Browse files Browse the repository at this point in the history
  • Loading branch information
AngryMaciek committed Sep 23, 2024
1 parent 71bc780 commit a9b08b3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
7 changes: 5 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ ENV LANG C.UTF-8
##### INSTALL SYSTEM-LEVEL DEPENDENCIES #####
RUN apt-get update \
&& apt-get install --no-install-recommends --yes \
ca-certificates cmake curl g++ gcc git gnupg2 gosu make vim wget \
ca-certificates cmake curl g++ gcc git gnupg2 gosu make vim wget zsh \
&& apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
Expand All @@ -25,6 +25,7 @@ RUN /bin/bash -c "curl -L ${MAMBAURL} > mambaforge.sh \
&& ${MAMBADIR}/bin/conda config --system --set channel_priority strict \
&& source ${MAMBADIR}/bin/activate \
&& conda init bash \
&& conda init zsh \
&& mamba install boa conda-build conda-verify -c conda-forge --yes \
&& conda clean --all --yes \
&& rm -f mambaforge.sh"
Expand All @@ -38,9 +39,11 @@ WORKDIR /workdir

##### SETUP ENTRYPOINT W/ NONROOT USER #####
COPY entrypoint.sh /bin/entrypoint.sh
COPY prezto-user-setup.sh /usr/local/bin/prezto-user-setup.sh
RUN /bin/bash -c "chmod +x /bin/entrypoint.sh \
&& groupadd conda \
&& chgrp -R conda ${MAMBADIR} \
&& chmod 770 -R ${MAMBADIR}"
&& chmod 770 -R ${MAMBADIR} \
&& chmod 755 /usr/local/bin/prezto-user-setup.sh"
ENTRYPOINT ["/bin/entrypoint.sh"]
CMD ["/bin/bash"]
5 changes: 4 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#!/bin/bash
echo "[INFO] angry user setup, please wait a moment..."
ID=${HOSTUID:-9001}
useradd --shell /bin/bash -u $ID -o -c "" -m angryuser
export HOME=/home/angryuser
adduser angryuser conda &> /dev/null
/usr/sbin/gosu angryuser /usr/local/bin/prezto-user-setup.sh &> /dev/null
/usr/sbin/gosu angryuser /bin/bash -c "/mambaforge/bin/conda init bash &> /dev/null"
/usr/sbin/gosu angryuser /bin/bash -c "/mambaforge/bin/conda init zsh &> /dev/null"
/usr/sbin/gosu angryuser /bin/bash -c "/mambaforge/bin/conda config --set changeps1 False &> /dev/null"
exec "$@"
7 changes: 7 additions & 0 deletions prezto-user-setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/zsh
cd $HOME
git clone --recursive https://github.com/AngryMaciek/prezto.git "${ZDOTDIR:-$HOME}/.zprezto"
setopt EXTENDED_GLOB
for rcfile in "${ZDOTDIR:-$HOME}"/.zprezto/runcoms/^README.md(.N); do
ln -s "$rcfile" "${ZDOTDIR:-$HOME}/.${rcfile:t}"
done

0 comments on commit a9b08b3

Please sign in to comment.