mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 06:21:27 +00:00
ensure color in dottie output by passing through env
This commit is contained in:
parent
020bda85db
commit
1976af6dd1
2 changed files with 42 additions and 10 deletions
|
@ -3,4 +3,9 @@
|
||||||
declare service="${PF_SERVICE:=worker}"
|
declare service="${PF_SERVICE:=worker}"
|
||||||
declare user="${PF_USER:=www-data}"
|
declare user="${PF_USER:=www-data}"
|
||||||
|
|
||||||
exec docker compose exec --user "${user}" "${service}" php artisan "${@}"
|
exec docker compose exec \
|
||||||
|
--user "${user}" \
|
||||||
|
--env TERM \
|
||||||
|
--env COLORTERM \
|
||||||
|
"${service}" \
|
||||||
|
php artisan "${@}"
|
||||||
|
|
|
@ -1,17 +1,44 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e -o errexit -o nounset -o pipefail
|
||||||
|
|
||||||
declare project_root="${PWD}"
|
declare project_root="${PWD}"
|
||||||
|
|
||||||
if command -v git &>/dev/null; then
|
if command -v git &>/dev/null; then
|
||||||
project_root=$(git rev-parse --show-toplevel)
|
project_root=$(git rev-parse --show-toplevel)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec docker run \
|
declare -r release="${DOTTIE_VERSION:-latest}"
|
||||||
--rm \
|
|
||||||
--interactive \
|
declare -r update_check_file="/tmp/.dottie-update-check" # file to check age of since last update
|
||||||
--tty \
|
declare -i update_check_max_age=$((8 * 60 * 60)) # 8 hours between checking for dottie version
|
||||||
--volume "${project_root}:/var/www" \
|
declare -i update_check_cur_age=$((update_check_max_age + 1)) # by default the "update" event should happen
|
||||||
--volume "/tmp:/tmp" \
|
|
||||||
--workdir /var/www \
|
# default [docker run] flags
|
||||||
ghcr.io/jippi/dottie \
|
declare -a flags=(
|
||||||
"$@"
|
--rm
|
||||||
|
--interactive
|
||||||
|
--tty
|
||||||
|
--env TERM
|
||||||
|
--env COLORTERM
|
||||||
|
--volume "/tmp:/tmp"
|
||||||
|
--volume "${project_root}:/var/www"
|
||||||
|
--workdir /var/www
|
||||||
|
)
|
||||||
|
|
||||||
|
# if update file exists, find its age since last modification
|
||||||
|
if [[ -f "${update_check_file}" ]]; then
|
||||||
|
now=$(date +%s)
|
||||||
|
changed=$(date -r "${update_check_file}" +%s)
|
||||||
|
update_check_cur_age=$((now - changed))
|
||||||
|
fi
|
||||||
|
|
||||||
|
# if update file is older than max allowed poll for new version of dottie
|
||||||
|
if [[ $update_check_cur_age -gt $update_check_max_age ]]; then
|
||||||
|
flags+=(--pull always)
|
||||||
|
|
||||||
|
touch "${update_check_file}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# run dottie
|
||||||
|
exec docker run "${flags[@]}" "ghcr.io/jippi/dottie:${release}" "$@"
|
||||||
|
|
Loading…
Reference in a new issue