From ff137674fef3dd0502198860153cd9f3f865f906 Mon Sep 17 00:00:00 2001 From: sneak Date: Wed, 4 Mar 2020 21:19:37 -0800 Subject: [PATCH] initial --- Dockerfile | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ Makefile | 8 ++++++ README.md | 12 ++++++++- root/.keep | 0 run.sh | 46 +++++++++++++++++++++++++++++++++ 5 files changed, 139 insertions(+), 1 deletion(-) create mode 100644 Dockerfile create mode 100644 Makefile create mode 100644 root/.keep create mode 100644 run.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..29db0fc --- /dev/null +++ b/Dockerfile @@ -0,0 +1,74 @@ +# focal 2020.01 dev +FROM ubuntu@sha256:d050ed7278c16ff627e4a70d7d353f1a2ec74d8a0b66e5a865356d92f5f6d87b + +ENV DEBIAN_FRONTEND noninteractive + +ARG UBUNTU_MIRROR=http://archive.ubuntu.com/ubuntu + +RUN echo "deb $UBUNTU_MIRROR focal main universe restricted multiverse" > /etc/apt/sources.list.new && \ +echo "deb $UBUNTU_MIRROR focal-updates main universe restricted multiverse" >> /etc/apt/sources.list.new && \ +echo "deb $UBUNTU_MIRROR focal-security main universe restricted multiverse" >> /etc/apt/sources.list.new && \ +echo "deb $UBUNTU_MIRROR focal-backports main universe restricted multiverse" >> /etc/apt/sources.list.new && \ +mv /etc/apt/sources.list.new /etc/apt/sources.list + + +# we only install essential system packages here +ARG SYSTEM_PACKAGES="build-essential ca-certificates git golang rsync runit software-properties-common" + +RUN \ + apt update && \ + apt -y upgrade && \ + apt -y install $SYSTEM_PACKAGES && \ + go get -v -u github.com/peterbourgon/runsvinit && \ + cp /root/go/bin/runsvinit /usr/local/sbin/runsvinit && \ + rm -r /root/go + +COPY ./root /tmp/rootoverlay +RUN rsync -avP /tmp/rootoverlay/ / && \ + rm -rf /tmp/rootoverlay + +# prereqs for discourse +RUN apt update && \ + apt -y install \ + advancecomp \ + autoconf \ + automake \ + bison \ + curl \ + debconf-utils \ + expect \ + gawk \ + gifsicle \ + git-core \ + gnupg2 \ + imagemagick \ + jhead \ + jpegoptim \ + libcurl4-openssl-dev \ + libffi-dev \ + libgdbm-dev \ + libjpeg-turbo-progs \ + libncurses5-dev \ + libpcre3 \ + libpcre3-dev \ + libreadline6-dev \ + libsqlite3-dev \ + libssl-dev \ + libtool \ + libyaml-dev \ + openssl \ + optipng \ + pngcrush \ + pngquant \ + python3-software-properties \ + redis-server \ + ruby-full \ + sqlite3 \ + sudo \ + vim \ + zlib1g-dev + +COPY ./run.sh /tmp/run.sh +RUN /bin/bash /tmp/run.sh && rm /tmp/run.sh + +CMD ["/usr/local/sbin/runsvinit"] diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..1b9fd6e --- /dev/null +++ b/Makefile @@ -0,0 +1,8 @@ +default: build + + +build: + docker build \ + -t sneak/discourse \ + --build-arg UBUNTU_MIRROR="http://ubuntu.datavi.be/ubuntu" \ + . diff --git a/README.md b/README.md index a494900..e463ef6 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,12 @@ -# discourse-docker +# datavibe-shell +This is the repository that builds the container for datavibe.net's user +shell service. + +# Contributing + +Pull requests are welcome. + +# Author + +sneak <[sneak@sneak.berlin](mailto:sneak@sneak.berlin)> diff --git a/root/.keep b/root/.keep new file mode 100644 index 0000000..e69de29 diff --git a/run.sh b/run.sh new file mode 100644 index 0000000..ca1c39c --- /dev/null +++ b/run.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +export HOME=/root + +set -e +set -x + +apt-get -yqq update + +curl -sSL https://rvm.io/mpapis.asc | gpg2 --import - +curl -sSL https://rvm.io/pkuczynski.asc | gpg2 --import - +curl -sSL https://get.rvm.io | bash -s stable +echo 'gem: --no-document' >> ~/.gemrc + +set +e +set +x +source /etc/profile.d/rvm.sh +rvm install 2.6.2 +rvm --default use 2.6.2 +set -e +set -x + +gem install bundler mailcatcher rake + + +# install pg10 +# ubuntu has a bootstrap script for pg repo install: +apt install -y postgresql-common +sh /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh + +apt-get update +apt-get install postgresql-10 pgadmin4 + +# start postgres somehow +sudo -u postgres -i +createuser --superuser -Upostgres discourse +psql -c "ALTER USER discourse WITH PASSWORD 'password';" + +curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash + +# FIXME activate nvm + +find $HOME +exit 1 + +chmod +x /etc/service/*/run