2022-09-08 22:44:13 +01:00
|
|
|
# docker build --file Dockerfile-devenv.txt -t devenv .
|
|
|
|
# docker run -it --name devenv -p 4200:4200 -d devenv zsh
|
2022-09-08 03:06:17 +01:00
|
|
|
FROM ubuntu:latest
|
2023-08-20 21:30:43 +01:00
|
|
|
ARG USERNAME=user
|
|
|
|
ARG USER_UID=1000
|
|
|
|
ARG USER_GID=$USER_UID
|
2022-09-08 03:06:17 +01:00
|
|
|
|
|
|
|
|
2023-08-20 21:30:43 +01:00
|
|
|
RUN groupadd --gid $USER_GID $USERNAME \
|
|
|
|
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
|
|
|
|
#
|
|
|
|
# [Optional] Add sudo support. Omit if you don't need to install software after connecting.
|
|
|
|
&& apt-get update \
|
|
|
|
&& apt-get install -y sudo \
|
|
|
|
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
|
|
|
|
&& chmod 0440 /etc/sudoers.d/$USERNAME
|
|
|
|
|
|
|
|
WORKDIR /home/$USERNAME
|
|
|
|
USER $USERNAME
|
|
|
|
|
2022-10-16 16:30:56 +01:00
|
|
|
|
2023-08-20 21:30:43 +01:00
|
|
|
RUN sudo apt-get update
|
|
|
|
RUN sudo apt-get upgrade -y
|
|
|
|
RUN sudo apt-get install zsh git curl bash vim nano openssh-server shellinabox -y
|
|
|
|
RUN sudo chsh -s $(which zsh) $USERNAME
|
|
|
|
RUN sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
|
|
|
|
RUN git clone https://github.com/zsh-users/zsh-autosuggestions.git /home/$USERNAME/.oh-my-zsh/custom/plugins/zsh-autosuggestions
|
|
|
|
RUN git clone https://github.com/zsh-users/zsh-syntax-highlighting.git /home/$USERNAME/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting
|
|
|
|
|
|
|
|
# RUN curl https://raw.githubusercontent.com/canha/golang-tools-install-script/master/goinstall.sh | bash
|
2022-09-08 03:06:17 +01:00
|
|
|
|
2023-08-20 21:30:43 +01:00
|
|
|
RUN echo export ZSH=\"\$HOME/.oh-my-zsh\" > /home/$USERNAME/.zshrc
|
|
|
|
RUN echo ZSH_THEME=\"robbyrussell\" >> /home/$USERNAME/.zshrc
|
|
|
|
RUN echo plugins=\(git zsh-autosuggestions zsh-syntax-highlighting\) >> /home/$USERNAME/.zshrc
|
|
|
|
RUN echo source \$ZSH/oh-my-zsh.sh >> /home/$USERNAME/.zshrc
|
|
|
|
#RUN echo service shellinabox start >> /home/$USERNAME/.zshrc
|
2022-09-08 03:06:17 +01:00
|
|
|
|
2023-08-20 21:30:43 +01:00
|
|
|
USER root
|
|
|
|
#RUN echo -e "new_password\nnew_password" | (passwd $USERNAME)
|
|
|
|
RUN echo "$USERNAME:password" | chpasswd
|
2022-09-08 03:06:17 +01:00
|
|
|
RUN sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/g' /etc/ssh/sshd_config
|
|
|
|
RUN sed -i 's/SHELLINABOX_ARGS="--no-beep"/SHELLINABOX_ARGS="--no-beep --disable-ssl"/g' /etc/default/shellinabox
|
|
|
|
|
|
|
|
|
2023-08-20 21:30:43 +01:00
|
|
|
USER $USERNAME
|
2022-09-08 03:06:17 +01:00
|
|
|
EXPOSE 4200
|
2023-08-20 21:48:03 +01:00
|
|
|
#CMD "/usr/bin/shellinaboxd --port 4200 --no-beep --disable-ssl"
|
|
|
|
CMD ["/usr/bin/shellinaboxd", "--port", "4200", "--no-beep", "--disable-ssl"]
|
|
|
|
#ENTRYPOINT ["sudo", "service", "shellinabox", "start"]
|
|
|
|
#CMD ["sudo", "service", "shellinabox", "start"]
|