diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..50a97b0 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,20 @@ +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 diff --git a/Dockerfile b/Dockerfile index 264e28c..2c1bf42 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,15 @@ -FROM phusion/baseimage:0.11 -CMD ["/sbin/my_init"] +FROM ubuntu:focal -ADD ./sources.list /etc/apt/sources.list +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 # 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 \ diff --git a/run.sh b/run.sh index 29892ba..7ac6f27 100644 --- a/run.sh +++ b/run.sh @@ -1,12 +1,25 @@ #!/bin/bash export DEBIAN_FRONTEND=noninteractive -USERNAME="sneak" - 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 <> /etc/sudoers +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 diff --git a/sources.list b/sources.list deleted file mode 100644 index 30e191e..0000000 --- a/sources.list +++ /dev/null @@ -1,4 +0,0 @@ -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