diff --git a/Dockerfile b/Dockerfile index bfdf8a2..264e28c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,4 +11,9 @@ RUN bash /tmp/run.sh && rm /tmp/run.sh RUN rm -f /etc/service/sshd/down #cleanup -RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* +RUN apt-get clean && \ + rm -rf \ + /var/lib/apt/lists/* \ + /tmp/* \ + /var/tmp/* \ + /etc/ssh/ssh_host_*_key diff --git a/Makefile b/Makefile index bdc0447..79a4866 100644 --- a/Makefile +++ b/Makefile @@ -4,9 +4,4 @@ BRANCH := $(shell git branch | sed -n -e 's/^\* \(.*\)/\1/p') default: build build: - script -q ./build.log docker build --no-cache -t sneak/sandbox . - docker tag sneak/sandbox sneak/sandbox:$(YYYYMMDD) - -push: - docker push sneak/sandbox - docker push sneak/sandbox:$(YYYYMMDD) + script -q ./build.log docker build --no-cache -t sneak/sandbox:$(YYYYMMDD) . diff --git a/run.sh b/run.sh index 716b3b6..29892ba 100644 --- a/run.sh +++ b/run.sh @@ -128,10 +128,26 @@ apt update apt install -y neovim mkdir -p /etc/bashrc.d -cat >> /etc/skel/.bashrc <<'EOF' +mkdir -p /etc/profile.d + +cat >> /etc/bash.bashrc <<'EOF' +if ! shopt -oq posix; then + if [ -f /usr/share/bash-completion/bash_completion ]; then + . /usr/share/bash-completion/bash_completion + elif [ -f /etc/bash_completion ]; then + . /etc/bash_completion + fi +fi + for FN in /etc/bashrc.d/*.sh; do source "$FN" done + +if ! shopt -oq posix; then + for FN in /etc/profile.d/*.sh; do + source "$FN" + done +fi EOF ################################################################################ @@ -141,7 +157,9 @@ EOF export NVM_DIR='/usr/local/nvm' mkdir -p "$NVM_DIR" curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash -echo 'source /usr/local/nvm/nvm.sh' > /etc/bashrc.d/100.nvm.sh +cat > /etc/bashrc.d/100.nvm.sh <<'EOF' +source /usr/local/nvm/nvm.sh +EOF source /etc/bashrc.d/100.nvm.sh nvm install node @@ -210,6 +228,10 @@ for PKG in $PIP_PKGS; do pip3 install $PKG done +################################################################################ +## add working user and add to sudo nopassword +################################################################################ groupadd -g 1000 $USERNAME useradd -u 1000 -g 1000 -s /bin/bash $USERNAME usermod -p '*' $USERNAME +echo "$USERNAME ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers