3 Commits

Author SHA1 Message Date
a1485030e8 latest, seems to sort of work 2019-08-04 19:02:42 -07:00
b8d90f2f8f set up working user 2019-08-04 03:12:26 -07:00
c7f2b8e9d2 add docker client 2019-08-04 02:19:48 -07:00
3 changed files with 38 additions and 9 deletions

View File

@@ -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

View File

@@ -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) .

33
run.sh
View File

@@ -1,6 +1,8 @@
#!/bin/bash
export DEBIAN_FRONTEND=noninteractive
USERNAME="sneak"
set -x
set -e
exec 1> >(tee -a /var/log/sandboxbuild.log) 2>&1
@@ -25,6 +27,7 @@ PKGS="
default-jre
diffstat
dnsutils
docker.io
dos2unix
editorconfig
ffmpeg
@@ -125,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
################################################################################
@@ -138,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
@@ -206,3 +227,11 @@ PIP_PKGS="
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