2020-10-09 23:53:41 -04:00
|
|
|
#! /usr/bin/env bash
|
2020-09-23 14:44:05 +00:00
|
|
|
|
2020-09-23 23:52:39 +00:00
|
|
|
## Set additional docker run arguments by changing the variable
|
2021-08-14 00:49:49 -04:00
|
|
|
## i2p_www_docker_run_args in an optional file called config.sh
|
|
|
|
## for example
|
|
|
|
##
|
|
|
|
##i2p_www_docker_run_args='-d'
|
|
|
|
## to run the site in the background, or
|
|
|
|
##
|
|
|
|
##i2p_www_docker_run_args='-t'
|
|
|
|
## to emulate a TTY
|
|
|
|
|
|
|
|
## To operate a quick and easy mirror of the I2P Site in a container
|
|
|
|
## simply clone the i2p.www source to a host with Docker installed, then
|
|
|
|
## add:
|
|
|
|
##
|
|
|
|
##i2p_www_docker_run_args='-d'
|
|
|
|
## to config.sh
|
|
|
|
##
|
|
|
|
## Then add:
|
|
|
|
##
|
|
|
|
##*/10 * * * * /path/to/i2p.www/site-updater-docker.sh
|
|
|
|
##
|
|
|
|
## to a crontab belonging to a member of the `docker` group. To add yourself
|
|
|
|
## to the `docker` group use the command:
|
|
|
|
##
|
|
|
|
##sudo adduser $(whoami) docker
|
|
|
|
##
|
|
|
|
## a more secure solution may be to create a user especially to run the
|
|
|
|
## docker crontab only, who is a member of the docker group. To do this,
|
|
|
|
##
|
|
|
|
##sudo adduser --disabled-password --disabled-login --ingroup docker docker
|
|
|
|
## however the specifics may vary from distribution to distribution.
|
|
|
|
|
2022-09-26 12:26:17 -04:00
|
|
|
dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
2021-08-14 00:49:49 -04:00
|
|
|
|
2022-09-26 12:26:17 -04:00
|
|
|
if [ -f "${dir}/config.sh" ]; then
|
|
|
|
. "${dir}/config.sh"
|
2021-08-14 00:49:49 -04:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z $port ]; then
|
|
|
|
port="8090"
|
|
|
|
fi
|
|
|
|
|
2021-09-14 17:49:54 -04:00
|
|
|
if [ -z $i2p_www_branch ]; then
|
|
|
|
i2p_www_branch=master
|
|
|
|
fi
|
2020-09-23 23:52:39 +00:00
|
|
|
|
|
|
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" || exit
|
2022-03-30 11:44:32 -04:00
|
|
|
cd "$DIR" || exit
|
2020-09-23 23:52:39 +00:00
|
|
|
|
2021-09-14 17:49:54 -04:00
|
|
|
git pull origin $i2p_www_branch
|
2022-04-20 20:11:52 -04:00
|
|
|
docker build $i2p_www_docker_build_args -t mirror.i2p.www$suffix .
|
2021-08-14 00:49:49 -04:00
|
|
|
docker rm -f mirror.i2p.www$suffix
|
2024-07-19 12:54:56 -04:00
|
|
|
docker run -it $i2p_www_docker_run_args --name mirror.i2p.www$suffix -p 127.0.0.1:5000:5000 -p 0.0.0.0:$port:80 $devmode mirror.i2p.www$suffix $@
|