diff --git a/Dockerfile b/Dockerfile index 07106f4..ccc0280 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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/* @@ -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" @@ -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"] diff --git a/entrypoint.sh b/entrypoint.sh index 99ee902..86f8340 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -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 "$@" diff --git a/prezto-user-setup.sh b/prezto-user-setup.sh new file mode 100644 index 0000000..346f5c5 --- /dev/null +++ b/prezto-user-setup.sh @@ -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