diff --git a/Dockerfile b/Dockerfile index a43b1a9..d17131e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,10 +3,14 @@ FROM phusion/baseimage:0.11 # Use baseimage-docker's init system. CMD ["/sbin/my_init"] -ADD setup.sh /tmp/setup.sh +# install os prereq stuff to image +ADD prereqs.sh /tmp/prereqs.sh +RUN bash /tmp/prereqs.sh -# install stuff to image -RUN bash /tmp/setup.sh +# install mastodon: +ADD install.sh /tmp/install.sh + +RUN chpst -u mastodon:mastodon bash /tmp/install.sh ADD ./rootfs / diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..c3dde69 --- /dev/null +++ b/install.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +export HOME="/mastodon" +export PATH="$HOME/.rbenv/bin:$PATH" +export RUBY_CONFIGURE_OPTS="--with-jemalloc" + +git clone https://github.com/rbenv/rbenv.git $HOME/.rbenv +cd $HOME/.rbenv && src/configure && make -C src +echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> $HOME/.bashrc +echo 'eval "$(rbenv init -)"' >> $HOME/.bashrc +git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build +eval "$(rbenv init -)" +rbenv install 2.6.1 +rbenv global 2.6.1 +gem update --system +gem install bundler --no-document + +git clone https://github.com/tootsuite/mastodon.git /mastodon/app +cd /mastodon/app +# v3.0.1: +git checkout c4118ba71ba31e408c02d289e111326ccc6f6aa2 + +bundle install \ + -j$(getconf _NPROCESSORS_ONLN) \ + --deployment --without development test +yarn install --pure-lockfile diff --git a/setup.sh b/prereqs.sh similarity index 72% rename from setup.sh rename to prereqs.sh index 5536d7a..c5748b1 100644 --- a/setup.sh +++ b/prereqs.sh @@ -61,20 +61,5 @@ apt install -y \ yarn \ zlib1g-dev -addgroup -g 991 mastodon +addgroup --gid 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 diff --git a/rootfs/etc/service/postgres/run b/rootfs/etc/service/postgres/run new file mode 100644 index 0000000..e69de29 diff --git a/rootfs/etc/service/redis/run b/rootfs/etc/service/redis/run new file mode 100644 index 0000000..e69de29 diff --git a/rootfs/etc/service/sidekiq/run b/rootfs/etc/service/sidekiq/run new file mode 100644 index 0000000..e69de29 diff --git a/rootfs/etc/service/streaming/run b/rootfs/etc/service/streaming/run new file mode 100644 index 0000000..e69de29 diff --git a/rootfs/etc/service/web/run b/rootfs/etc/service/web/run new file mode 100644 index 0000000..e69de29