This commit is contained in:
Jeffrey Paul 2019-12-07 21:10:21 -08:00
commit 21ee1776b5
4 changed files with 114 additions and 0 deletions

17
Dockerfile Normal file
View File

@ -0,0 +1,17 @@
FROM phusion/baseimage:0.11
# Use baseimage-docker's init system.
CMD ["/sbin/my_init"]
ADD setup.sh /tmp/setup.sh
# install stuff to image
RUN bash /tmp/setup.sh
ADD ./rootfs /
RUN chmod +x /usr/local/bin/* /etc/service/*/run
VOLUME /state
EXPOSE 3000 4000

4
Makefile Normal file
View File

@ -0,0 +1,4 @@
default: build
build:
docker build -t sneak/mastodon .

13
README.md Normal file
View File

@ -0,0 +1,13 @@
# true single-container mastodon
don't ever host things anywhere but on your own domain.
this violates all the docker best practices and puts the whole-ass app inside a single container (including redis and postgres!) so that you can easily bring up a sef-hosted mastodon on things like caprover in a single "app" without having to worry about cross-container links.
i really just wanted a one-command single-user mastodon.
# credits
all praise to wonderfall's single-container mastodon:
https://github.com/Wonderfall/docker-mastodon

80
setup.sh Normal file
View File

@ -0,0 +1,80 @@
#!/bin/bash
set -x
export DEBIAN_FRONTEND=noninteractive
MRUM="main restricted universe multiverse"
M="mirror://mirrors.ubuntu.com/mirrors.txt"
cat > /etc/apt/sources.list <<EOF
deb $M bionic $MRUM
deb $M bionic-updates $MRUM
deb $M bionic-security $MRUM
deb $M bionic-backports $MRUM
EOF
# these instructions are cribbed from
# https://docs.joinmastodon.org/administration/installation/
# this is fine, totally secure, nothing to see here
curl -sL https://deb.nodesource.com/setup_8.x | bash -
# same here
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
apt update
apt install -y \
autoconf \
bison \
build-essential \
daemontools \
ffmpeg \
file \
g++ \
gcc \
git-core \
imagemagick \
libffi-dev \
libgdbm-dev \
libgdbm5 \
libicu-dev \
libidn11-dev \
libjemalloc-dev \
libncurses5-dev \
libpq-dev \
libprotobuf-dev \
libreadline6-dev \
libssl-dev \
libxml2-dev \
libxslt1-dev \
libyaml-dev \
nginx \
nodejs \
pkg-config \
postgresql \
postgresql-contrib \
protobuf-compiler \
redis-server \
redis-tools \
yarn \
zlib1g-dev
addgroup -g 991 mastodon
useradd --uid 991 --gid 991 -m -d /mastodon mastodon
exit 0
su - mastodon <<'EOF'
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
cd ~/.rbenv && src/configure && make -C src
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
source ~/.bashrc
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
RUBY_CONFIGURE_OPTS=--with-jemalloc rbenv install 2.6.1
rbenv global 2.6.1
gem update --system
gem install bundler --no-document
EOF