This is a followup on Make FSFE gitea available for the general public - #6 by dashohoxha that i decided to put in a new post to avoid going off-topic and to show how the community review could work as discussed in FSFE-defined coding standards? - #14 by kreyren
Review about scripts/gitea.sh · master · docker-scripts / gitea · GitLab
Consider POSIX as it makes your shell script more functional
Shell is not C/C++/Rustlang this is a bad practice imho
This task should be called only once and as such function definition is bloat
Consider:
cat <<-CONFIG ...
[Unit]
Description=Gitea (Git with a cup of tea)
After=syslog.target
CONFIG
For better readability
I would be checking for content there instead of file for it to be more robust
Also by wrapping everything in script instead of using RUN
you are making the whole work harder to work with as the steps are cached.
Also consider using shellcheck GitHub - koalaman/shellcheck: ShellCheck, a static analysis tool for shell scripts to lint the code.
You are also using various scripts to set up databases which i consider a bad design as the databases should be deployed using a docker-compose set up using environment variables e.g. http://ix.io/2Ph5 so that you can deploy them on demand.
Consider looking on my rework in Docker: Rework by Kreyren · Pull Request #14626 · go-gitea/gitea · GitHub with design decisions and i recommend proposing the changes to upstream so that they can be maintained and deployed there.