Files
sori.studio/scripts/backfill-post-thumbnails-production.sh

41 lines
751 B
Bash
Executable File

#!/bin/sh
set -eu
ROOT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
APP_SERVICE=${APP_SERVICE:-sori-studio}
COMPOSE_ENV_FILE=
cd "$ROOT_DIR"
pick_compose_env_file() {
if [ -n "${ENV_FILE:-}" ] && [ -r "$ENV_FILE" ]; then
COMPOSE_ENV_FILE=$ENV_FILE
return 0
fi
if [ -r .env.production ]; then
COMPOSE_ENV_FILE=.env.production
return 0
fi
if [ -r .env ]; then
COMPOSE_ENV_FILE=.env
return 0
fi
COMPOSE_ENV_FILE=
}
compose() {
if [ -n "$COMPOSE_ENV_FILE" ]; then
docker compose --env-file "$COMPOSE_ENV_FILE" "$@"
return 0
fi
docker compose "$@"
}
pick_compose_env_file
compose up -d "$APP_SERVICE"
compose exec -T "$APP_SERVICE" node .output/server/scripts/backfill-post-thumbnails.js