about summary refs log tree commit diff
path: root/deploy/scripts/update-containers.sh
blob: 302731cdfd605df9e761d25c1ca85a9e84cb75b1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/bash

[ -z "$COMPOSE" ] && COMPOSE="$(command -v docker-compose)"
[ -z "$COMPOSE" ] && COMPOSE="/usr/local/bin/docker-compose"

cd "$HOME" || exit

[ -z "$NGINX_WEBHOOK" ] || printf "Content-Type: text/plain\r\n\r\n"

($COMPOSE pull 2>&1 | grep --silent "Downloaded newer") && {
  $COMPOSE up -d

  docker cp "$($COMPOSE ps -q mstweb):/mastodon/public/assets" public/
  docker cp "$($COMPOSE ps -q mstweb):/mastodon/public/packs" public/

  docker system prune --all -f

  curl -sS "https://raw.githubusercontent.com/pluralcafe/utils/master/deploy/docker-compose.yml" > docker-compose.yml
}