#!/bin/bash set -e SCRIPT_DIR=$(readlink -f $(dirname "${BASH_SOURCE[0]}")) REPO_DIR=$(dirname $SCRIPT_DIR) ENV_FILE=$REPO_DIR/.env echo "Reading env variables from $ENV_FILE" source $ENV_FILE if [ -z "$DATA_DIR" ]; then echo "Error: DATA_DIR is not set." exit 1 fi if [ -z "$RESTIC_REPOSITORY" ]; then echo "Error: RESTIC_REPOSITORY is not set." exit 1 fi if [ -z "$RESTIC_PASSWORD" ]; then echo "Error: RESTIC_PASSWORD is not set." exit 1 fi docker run -it --rm \ --hostname $HOSTNAME \ --env-file $ENV_FILE \ -v /etc/localtime:/etc/localtime:ro \ -v /etc/timezone:/etc/timezone:ro \ -v $DATA_DIR:/data \ -v $RESTIC_REPOSITORY:$RESTIC_REPOSITORY \ restic/restic:latest "$@"