新バージョン: https://github.com/mamemomonga/docker-rpi-mastodon-build
DockerHub: https://hub.docker.com/u/mamemomonga/
$ curl https://get.docker.com/ | sh
$ sudo sh -c 'usermod -a -G docker $SUDO_USER'
再ログイン
$ sudo fallocate -l 4G /swap
$ sudo chmod 600 /swap
$ sudo mkswap /swap
$ sudo swapon /swap
$ mkdir docker-app
$ cd docker-app
$ cat > builds1.sh << 'EOS'
mkdir node
cd node
wget https://raw.githubusercontent.com/nodejs/docker-node/72dd945d29dee5afa73956ebc971bf3a472442f7/8/alpine/Dockerfile
docker build -t mamemomonga/rpi-node:8.11.3-alpine .
cd ..
mkdir ruby
cd ruby
wget https://raw.githubusercontent.com/docker-library/ruby/c43fef8a60cea31eb9e7d960a076d633cb62ba8d/2.4/alpine3.6/Dockerfile
docker build -t mamemomonga/rpi-ruby:2.4.4-alpine3.6 .
cd ..
EOS
$ nohup bash builds1.sh &
$ tail -f nohup.out
寝る → 起きる → どうやらうまくできたようなので
$ docker login
$ docker push mamemomonga/rpi-ruby
$ docker push mamemomonga/rpi-node
$ sudo apt install git
$ git clone https://github.com/tootsuite/mastodon.git
$ cd mastodon
$ git checkout v2.4.3
(v2.4.3ではnodeはいらなかったようだ...)
$ vim Dockerfile
FROM ruby:2.4.4-alpine3.6
↓
FROM mamemomonga/rpi-ruby:2.4.4-alpine3.6
$ nohup docker build -t mamemomonga/rpi-mastodon:v2.4.3 . &
$ tail -f nohup.out
こうしたほう最新Stableバージョンを追いかけるので。
$ export MASTODON_VER=$(git tag -l | grep -v 'rc[0-9]*$' | sort -V | tail -n 1)
$ echo $MASTODON_VER
v2.4.5
$ git checkout $MASTODON_VER
$ perl -i.orig -nlpE 's#\QFROM ruby:2.4.4-alpine3.6\E#FROM mamemomonga/rpi-ruby:2.4.4-alpine3.6#' Dockerfile
$ docker build -t mamemomonga/armhf-mastodon:$MASTODON_VER .
寝る → 起きる → どうやらうまくできたようなので公開。
$ docker push mamemomonga/rpi-mastodon:v2.4.3
しかしここまでつくって、docker-composeで動かすには redisとpostgresqlのビルドも必要と気づく。
せっかくなんで
エラーなければ公開まで自動でやる。
$ cat > builds2.sh << 'EOS'
mkdir postgres
cd postgres
wget https://raw.githubusercontent.com/docker-library/postgres/master/9.6/alpine/Dockerfile
wget https://raw.githubusercontent.com/docker-library/postgres/master/9.6/alpine/docker-entrypoint.sh
docker build -t mamemomonga/rpi-postgres:9.6-alpine .
docker push mamemomonga/rpi-postgres:9.6-alpine
cd ..
mkdir redis
cd redis
wget https://raw.githubusercontent.com/docker-library/redis/master/4.0/alpine/Dockerfile
wget https://raw.githubusercontent.com/docker-library/redis/master/4.0/alpine/docker-entrypoint.sh
docker build -t mamemomonga/rpi-redis:4.0-alpine .
docker push mamemomonga/rpi-redis:4.0-alpine
cd ..
EOS
$ nohup sh -eux builds2.sh &
$ tail -f nohup.out
晩ご飯をたべる。なんかうまくできてたので
$ git clone https://github.com/docker/compose.git
$ cd compose
$ git checkout 1.22.0
$ nohup sh -c 'docker build -t mamemomonga/rpi-docker-compose:1.22.0 -f Dockerfile.armhf . && docker push mamemomonga/rpi-docker-compose:1.22.0' &
$ tail -f nohup.out