Compare commits

..

No commits in common. "41114ce60a1980c615288a941f593435c2f065a3" and "5713b283ed0ddb9f440cb410bd683f3693c8e663" have entirely different histories.

5 changed files with 24 additions and 92 deletions

View File

@ -1,20 +0,0 @@
kind: pipeline
name: default
steps:
- name: docker
image: plugins/docker
network_mode: bridge
settings:
build_args:
- UBUNTU_MIRROR_URL=http://ubuntumirror.app.las1.eeqj.de/ubuntu
repo: sneak/sandbox
username:
from_secret: docker_username
password:
from_secret: docker_password
tags:
- ${DRONE_BRANCH//\//-}-${DRONE_COMMIT_SHA:0:8}
- ${DRONE_COMMIT_SHA}
- ${DRONE_BRANCH/\//-}
- latest

View File

@ -1,19 +1,14 @@
FROM ubuntu:focal
FROM phusion/baseimage:0.11
CMD ["/sbin/my_init"]
ARG USERNAME_TO_ADD=user
ARG UID_TO_ADD=1000
ARG GID_TO_ADD=1000
ARG UBUNTU_MIRROR_URL=http://us.archive.ubuntu.com/ubuntu
ADD ./sources.list /etc/apt/sources.list
# setup
ADD ./run.sh /tmp/run.sh
RUN bash /tmp/run.sh && rm /tmp/run.sh
# enable ssh
RUN rm -f /etc/service/sshd/down
#cleanup
RUN apt-get clean && \
rm -rf \
/var/lib/apt/lists/* \
/tmp/* \
/var/tmp/* \
/etc/ssh/ssh_host_*_key
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

View File

@ -4,4 +4,9 @@ BRANCH := $(shell git branch | sed -n -e 's/^\* \(.*\)/\1/p')
default: build
build:
script -q ./build.log docker build --no-cache -t sneak/sandbox:$(YYYYMMDD) .
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)

66
run.sh
View File

@ -5,21 +5,6 @@ set -x
set -e
exec 1> >(tee -a /var/log/sandboxbuild.log) 2>&1
MURM="main universe restricted multiverse"
M="http://us.archive.ubuntu.com/ubuntu"
C="$(lsb_release -cs)"
if [[ ! -z "$UBUNTU_MIRROR_URL" ]]; then
M="$UBUNTU_MIRROR_URL"
fi
cat > /etc/apt/sources.list.new <<EOF
deb $M $C $MURM
deb $M $C-updates $MURM
deb $M $C-backports $MURM
deb $M $C-security $MURM
EOF
PKGS="
apt-transport-https
apt-utils
@ -40,7 +25,6 @@ PKGS="
default-jre
diffstat
dnsutils
docker.io
dos2unix
editorconfig
ffmpeg
@ -60,7 +44,6 @@ PKGS="
lcov
ldap-auth-client
ldap-utils
lftp
libasound2
libatk1.0-0
libboost-all-dev
@ -94,11 +77,15 @@ PKGS="
pbzip2
pinentry-curses
pkg-config
pkg-config
psmisc
pv
pwgen
python
python3
python-dev
python3-dev
python-pip
python3-pip
rbenv
rsync
@ -138,38 +125,10 @@ apt update
apt install -y neovim
mkdir -p /etc/bashrc.d
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
cat >> /etc/skel/.bashrc <<'EOF'
for FN in /etc/bashrc.d/*.sh; do
source "$FN"
done
if [[ -d "$HOME/.bashrc.d" ]]; then
for FN in /etc/bashrc.d/*.sh; do
source "$FN"
done
fi
if ! shopt -oq posix; then
for FN in /etc/profile.d/*.sh; do
source "$FN"
done
if [[ -d "$HOME/.profile.d" ]]; then
for FN in /etc/profile.d/*.sh; do
source "$FN"
done
fi
fi
EOF
################################################################################
@ -179,9 +138,7 @@ 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
cat > /etc/bashrc.d/100.nvm.sh <<'EOF'
source /usr/local/nvm/nvm.sh
EOF
echo 'source /usr/local/nvm/nvm.sh' > /etc/bashrc.d/100.nvm.sh
source /etc/bashrc.d/100.nvm.sh
nvm install node
@ -226,7 +183,7 @@ done
## install ppss, paralell processing shell script
################################################################################
cd /usr/local/bin
wget https://git.eeqj.de/sneak/ppss/raw/branch/master/ppss
wget https://raw.githubusercontent.com/sneak/ppss/master/ppss
chmod +x ./ppss
################################################################################
@ -244,17 +201,8 @@ PIP_PKGS="
pipenv
pylint
virtualenv
glances
"
for PKG in $PIP_PKGS; do
pip3 install $PKG
done
################################################################################
## add working user and add to sudo nopassword
################################################################################
groupadd -g $GID_TO_ADD $USERNAME_TO_ADD
useradd -u $UID_TO_ADD -g $GID_TO_ADD -s /bin/bash $USERNAME_TO_ADD
usermod -p '*' $USERNAME_TO_ADD
echo "$USERNAME_TO_ADD ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers

4
sources.list Normal file
View File

@ -0,0 +1,4 @@
deb mirror://mirrors.ubuntu.com/mirrors.txt bionic main universe multiverse restricted
deb mirror://mirrors.ubuntu.com/mirrors.txt bionic-updates main universe multiverse restricted
deb mirror://mirrors.ubuntu.com/mirrors.txt bionic-security main universe multiverse restricted
deb mirror://mirrors.ubuntu.com/mirrors.txt bionic-backports main universe multiverse restricted