2022-05-09 09:53:53 +12:00
|
|
|
FROM ubuntu:20.04
|
2021-07-31 00:18:29 +12:00
|
|
|
|
|
|
|
COPY unified-supervisord.conf supervisord.conf /etc/supervisord/
|
|
|
|
COPY mc.ini /home/abc/.config/mc/ini
|
|
|
|
COPY zsh-in-docker.sh /tmp/zsh-in-docker.sh
|
|
|
|
|
|
|
|
# Systemctl within Docker and Python 3.9
|
2022-05-09 09:53:53 +12:00
|
|
|
RUN DEBIAN_FRONTEND=noninteractive apt-get -y update \
|
2022-05-22 19:29:05 +12:00
|
|
|
&& echo "------------------------------------------------------ Common stuff" \
|
|
|
|
&& apt-get install -y sudo curl wget telnet jq \
|
2021-07-31 00:18:29 +12:00
|
|
|
&& apt-get install -y software-properties-common \
|
2021-08-29 21:28:32 +12:00
|
|
|
&& apt-get install -y zip gzip tar \
|
2021-07-31 00:18:29 +12:00
|
|
|
&& echo "------------------------------------------------------ User" \
|
|
|
|
&& useradd -u 8877 abc \
|
2022-07-13 07:27:38 +12:00
|
|
|
&& chown -R abc /home \
|
2021-07-31 00:18:29 +12:00
|
|
|
&& mkdir -p /home/abc \
|
|
|
|
&& chown -R abc /home/abc \
|
2022-07-13 07:27:38 +12:00
|
|
|
&& echo "------------------------------------------------------ docker systemctl replacement" \
|
|
|
|
&& wget https://raw.githubusercontent.com/gdraheim/docker-systemctl-replacement/master/files/docker/systemctl3.py -O /usr/local/bin/systemctl \
|
|
|
|
&& chown -R abc /usr/local/bin/systemctl \
|
2021-07-31 00:18:29 +12:00
|
|
|
&& echo "------------------------------------------------------ Python" \
|
|
|
|
&& apt-get install -y python3-distutils \
|
|
|
|
&& apt-get install -y python3-pip \
|
2022-05-09 09:53:53 +12:00
|
|
|
&& apt-get install -y python3-venv \
|
|
|
|
&& pip install --upgrade pip \
|
|
|
|
&& pip install --upgrade setuptools \
|
|
|
|
&& pip install --upgrade distlib \
|
2021-07-31 00:18:29 +12:00
|
|
|
&& update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1 \
|
2022-05-09 09:53:53 +12:00
|
|
|
&& echo "------------------------------------------------------ Allow users some priviledged actions" \
|
2021-07-31 00:18:29 +12:00
|
|
|
&& echo "# Allow non-admin users to install packages" >> /etc/sudoers \
|
2022-05-13 10:13:04 +12:00
|
|
|
&& echo "abc ALL = NOPASSWD : /usr/bin/apt, /usr/bin/apt-get, /usr/bin/aptitude, /usr/bin/add-apt-repository, /usr/local/bin/pip, /usr/local/bin/systemctl, /usr/bin/dpkg, /usr/sbin/dpkg-reconfigure" >> /etc/sudoers \
|
2022-05-09 09:53:53 +12:00
|
|
|
&& echo "------------------------------------------------------ GIT" \
|
|
|
|
&& apt-get install -y git git-flow \
|
|
|
|
&& wget -P /tmp https://github.com/jesseduffield/lazygit/releases/download/v0.34/lazygit_0.34_Linux_x86_64.tar.gz \
|
|
|
|
&& mkdir /tmp/lazygit && tar -xzf /tmp/lazygit_0.34_Linux_x86_64.tar.gz --directory /tmp/lazygit \
|
|
|
|
&& chmod +x /tmp/lazygit/lazygit \
|
|
|
|
&& mv /tmp/lazygit/lazygit /usr/bin/ \
|
|
|
|
&& rm /tmp/lazygit_0.34_Linux_x86_64.tar.gz \
|
|
|
|
&& rm -rf /tmp/lazygit \
|
2021-07-31 00:18:29 +12:00
|
|
|
&& echo "------------------------------------------------------ Nodeenv" \
|
|
|
|
&& pip install nodeenv \
|
|
|
|
&& apt-get install -y yarn \
|
|
|
|
&& echo "------------------------------------------------------ Cron" \
|
|
|
|
&& apt-get install -y cron \
|
|
|
|
&& mkdir -p /var/log/supervisord/ \
|
2022-07-13 07:27:38 +12:00
|
|
|
&& chown -R abc /var/spool/cron/crontabs \
|
|
|
|
&& chown -R abc /var/log \
|
2021-07-31 00:18:29 +12:00
|
|
|
&& chmod gu+rw /var/run \
|
|
|
|
&& chmod gu+s /usr/sbin/cron \
|
|
|
|
&& echo "# Allow cron for user abc" >> /etc/sudoers \
|
|
|
|
&& echo "abc ALL = NOPASSWD : /usr/sbin/cron " >> /etc/sudoers \
|
|
|
|
&& echo "------------------------------------------------------ Supervisor" \
|
|
|
|
&& apt-get remove -y cmdtest \
|
|
|
|
&& apt-get install -y supervisor \
|
|
|
|
&& pip3 install supervisor==4.2.2 \
|
2022-05-09 09:53:53 +12:00
|
|
|
&& apt-get -y update \
|
2021-07-31 00:18:29 +12:00
|
|
|
&& apt-get install -y systemd \
|
2022-07-13 07:27:38 +12:00
|
|
|
&& chown -R abc /etc/supervisord/ \
|
|
|
|
&& chown -R abc /var/log/supervisord/ \
|
2021-07-31 00:18:29 +12:00
|
|
|
&& echo "------------------------------------------------------ ZSH root" \
|
|
|
|
&& HOME=/root \
|
|
|
|
&& chmod +x /tmp/zsh-in-docker.sh \
|
|
|
|
&& /tmp/zsh-in-docker.sh \
|
|
|
|
-t https://github.com/pascaldevink/spaceship-zsh-theme \
|
|
|
|
-a 'SPACESHIP_PROMPT_ADD_NEWLINE="false"' \
|
|
|
|
-a 'SPACESHIP_PROMPT_SEPARATE_LINE="false"' \
|
|
|
|
-a 'export LS_COLORS="$LS_COLORS:ow=1;34:tw=1;34:"' \
|
|
|
|
-a 'SPACESHIP_USER_SHOW="false"' \
|
|
|
|
-a 'SPACESHIP_TIME_SHOW="true"' \
|
|
|
|
-a 'SPACESHIP_TIME_COLOR="grey"' \
|
|
|
|
-a 'SPACESHIP_DIR_COLOR="cyan"' \
|
|
|
|
-a 'SPACESHIP_GIT_SYMBOL="⇡"' \
|
|
|
|
-a 'SPACESHIP_BATTERY_SHOW="false"' \
|
|
|
|
-a 'if [[ $(pwd) != /root ]]; then cd /root; fi # Set starting dir to /root ' \
|
|
|
|
-a 'hash -d r=/root' \
|
|
|
|
-p git \
|
|
|
|
-p https://github.com/zsh-users/zsh-autosuggestions \
|
|
|
|
-p https://github.com/zsh-users/zsh-completions \
|
|
|
|
-p https://github.com/zsh-users/zsh-history-substring-search \
|
|
|
|
-p https://github.com/zsh-users/zsh-syntax-highlighting \
|
|
|
|
-p 'history-substring-search' \
|
|
|
|
-p https://github.com/bobthecow/git-flow-completion \
|
|
|
|
-a 'bindkey "\$terminfo[kcuu1]" history-substring-search-up' \
|
|
|
|
-a 'bindkey "\$terminfo[kcud1]" history-substring-search-down' \
|
|
|
|
&& printf '%s\n%s\n' "export ZSH_DISABLE_COMPFIX=true" "$(cat /root/.zshrc)" > /root/.zshrc \
|
|
|
|
&& echo "------------------------------------------------------ ZSH abc" \
|
|
|
|
&& mkdir -p /home/project \
|
|
|
|
&& HOME=/home/abc \
|
|
|
|
&& /tmp/zsh-in-docker.sh \
|
|
|
|
-t https://github.com/pascaldevink/spaceship-zsh-theme \
|
2022-05-09 09:53:53 +12:00
|
|
|
-a 'DISABLE_UPDATE_PROMPT="true"' \
|
2021-07-31 00:18:29 +12:00
|
|
|
-a 'SPACESHIP_PROMPT_ADD_NEWLINE="false"' \
|
|
|
|
-a 'SPACESHIP_PROMPT_SEPARATE_LINE="false"' \
|
|
|
|
-a 'export LS_COLORS="$LS_COLORS:ow=1;34:tw=1;34:"' \
|
|
|
|
-a 'SPACESHIP_USER_SHOW="true"' \
|
|
|
|
-a 'SPACESHIP_TIME_SHOW="true"' \
|
|
|
|
-a 'SPACESHIP_TIME_COLOR="grey"' \
|
|
|
|
-a 'SPACESHIP_DIR_COLOR="cyan"' \
|
|
|
|
-a 'SPACESHIP_GIT_SYMBOL="⇡"' \
|
|
|
|
-a 'SPACESHIP_BATTERY_SHOW="false"' \
|
|
|
|
-a 'if [[ $(pwd) != /home/project ]]; then cd /home/project; fi # Set starting dir to /home/project ' \
|
|
|
|
-a 'hash -d p=/home/project' \
|
|
|
|
-p git \
|
|
|
|
-p https://github.com/zsh-users/zsh-autosuggestions \
|
|
|
|
-p https://github.com/zsh-users/zsh-completions \
|
|
|
|
-p https://github.com/zsh-users/zsh-history-substring-search \
|
|
|
|
-p https://github.com/zsh-users/zsh-syntax-highlighting \
|
|
|
|
-p 'history-substring-search' \
|
|
|
|
-p https://github.com/bobthecow/git-flow-completion \
|
|
|
|
-a 'bindkey "\$terminfo[kcuu1]" history-substring-search-up' \
|
|
|
|
-a 'bindkey "\$terminfo[kcud1]" history-substring-search-down' \
|
|
|
|
&& rm /tmp/zsh-in-docker.sh \
|
|
|
|
&& printf '%s\n%s\n' "export ZSH_DISABLE_COMPFIX=true" "$(cat /home/abc/.zshrc)" > /home/abc/.zshrc \
|
2022-05-09 09:53:53 +12:00
|
|
|
&& echo "------------------------------------------------------ Code editors" \
|
|
|
|
&& apt-get install -y nano vim \
|
2022-07-13 07:27:38 +12:00
|
|
|
&& echo "------------------------------------------------------ File browsers: MC" \
|
2022-05-09 09:53:53 +12:00
|
|
|
&& apt-get install -y mc \
|
2022-07-13 07:27:38 +12:00
|
|
|
&& echo "------------------------------------------------------ multitasking in a terminal " \
|
|
|
|
&& apt-get install -y tmux \
|
2022-05-09 09:53:53 +12:00
|
|
|
&& echo "------------------------------------------------------ Sys monitoring: Glances, Vizex" \
|
|
|
|
&& apt-get install -y ncdu htop \
|
|
|
|
&& pip install glances==3.2.5 \
|
|
|
|
&& pip install vizex==2.1.0 \
|
2021-07-31 00:18:29 +12:00
|
|
|
&& echo "------------------------------------------------------ Web-based terminal" \
|
2022-05-22 19:29:05 +12:00
|
|
|
&& cd /tmp && wget https://github.com/tsl0922/ttyd/releases/download/1.6.3/ttyd.x86_64 \
|
|
|
|
&& mv ttyd.x86_64 /usr/bin/ttyd \
|
2021-09-15 20:12:08 +12:00
|
|
|
&& chmod +x /usr/bin/ttyd \
|
|
|
|
&& echo "------------------------------------------------------ utils" \
|
|
|
|
&& git clone https://github.com/bluxmit/alnoda-workspaces /tmp/alnoda-workspaces \
|
|
|
|
&& mv /tmp/alnoda-workspaces/utils /home/abc/ \
|
|
|
|
&& rm -rf /tmp/alnoda-workspaces \
|
2021-07-31 00:18:29 +12:00
|
|
|
&& echo "------------------------------------------------------ User" \
|
|
|
|
&& chown abc /home/project \
|
|
|
|
&& mkdir -p /home/abc/.local/bin \
|
2022-07-13 07:27:38 +12:00
|
|
|
&& chown abc /home/abc/.local && chown abc /home/abc/.local/bin \
|
2021-07-31 00:18:29 +12:00
|
|
|
&& chown abc /home/abc/.local && chown abc /home/abc/.local/bin \
|
|
|
|
&& find /home -type d | xargs -I{} chown -R abc {} \
|
|
|
|
&& find /home -type f | xargs -I{} chown abc {} \
|
2022-05-09 09:53:53 +12:00
|
|
|
&& echo "------------------------------------------------------ Aliases" \
|
|
|
|
&& echo 'alias python="python3"' >> /root/.zshrc \
|
|
|
|
&& echo 'alias python="python3"' >> /home/abc/.zshrc \
|
2021-07-31 00:18:29 +12:00
|
|
|
&& echo "------------------------------------------------------ Clean" \
|
|
|
|
&& apt-get -y autoremove \
|
|
|
|
&& apt-get -y clean \
|
2022-05-09 09:53:53 +12:00
|
|
|
&& apt-get -y autoclean \
|
|
|
|
&& rm -rf /home/abc/.oh-my-zsh/.git \
|
|
|
|
&& rm -rf /home/abc/.oh-my-zsh/.github \
|
|
|
|
&& rm -rf /home/abc/.oh-my-zsh/custom/plugins/git-flow-completion/.git \
|
|
|
|
&& rm -rf /home/abc/.oh-my-zsh/custom/plugins/zsh-autosuggestions/.git \
|
|
|
|
&& rm -rf /home/abc/.oh-my-zsh/custom/plugins/zsh-completions/.git \
|
|
|
|
&& rm -rf /home/abc/.oh-my-zsh/custom/plugins/zsh-history-substring-search/.git \
|
|
|
|
&& rm -rf /home/abc/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting/.git \
|
|
|
|
&& rm -rf /home/abc/.oh-my-zsh/custom/themes/spaceship-zsh-theme/.git
|
2021-07-31 00:18:29 +12:00
|
|
|
|
|
|
|
USER abc
|
|
|
|
|
|
|
|
ENV PATH="/home/abc/.local/bin:${PATH}"
|
|
|
|
|
|
|
|
###### ENTRY
|
|
|
|
|
|
|
|
# note! this will have consequences only when started as root (docker run ... --user root ...)
|
|
|
|
# systemctl start systemd-journald
|
2022-05-22 19:29:05 +12:00
|
|
|
# I remove this from entrypoint, as it is not used significantly, but slows down the start
|
2021-07-31 00:18:29 +12:00
|
|
|
|
|
|
|
# this entrypoint should be the same for all images that are built on top of this one
|
2022-05-22 19:29:05 +12:00
|
|
|
ENTRYPOINT /etc/init.d/cron start; supervisord -c "/etc/supervisord/unified-supervisord.conf"
|