reductionist 0.12.0

S3 Active Storage server
Documentation
#!/usr/bin/env bash

set -e

origin=$(dirname "$0")
origin=$(cd "$origin"; pwd)
me=$(basename "$0")

volume="$1"
if [ -z "$volume" ]; then
    cat <<EOF

usage: $me <path to share>

EOF
    exit 1
fi
volume=$(cd "$volume"; pwd)

# Setup htpasswd for basic authentication.
# NOTE: Do NOT commit generated htpasswd contents to version control,
#       it will be ignored using the following default location.
# To change the credentials used:
# - replace: admin admin
# - with   : <your desired username> <your desired password>
htpasswd -bc "$origin/htpasswd" admin admin

# Start our local nginx
# https://hub.docker.com/_/nginx
echo "Starting nginx serving on '$volume'"
docker run \
    --name nginx-user-share \
    --rm \
    -d \
    -p 8000:80 \
    -v "$origin/nginx.conf:/etc/nginx/conf.d/default.conf" \
    -v "$origin/htpasswd:/etc/nginx/htpasswd" \
    -v "$volume:/usr/share/nginx/html" \
    docker.io/nginx