mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-08-02 20:15:24 +02:00
chore: refactor-docker-structure (#1948)
* move dockerfiles to dedicated folder * consolidate docker related files to docker dir * update CI references * experimental omni style container * update makefile commands * update references * fix whitespace * single container docs * update build paths * adds omni style build * set context
This commit is contained in:
parent
c4eebaccca
commit
e281f53488
22 changed files with 366 additions and 127 deletions
59
docker/api.entry.sh
Normal file
59
docker/api.entry.sh
Normal file
|
@ -0,0 +1,59 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
# Get Reload Arg `run.sh reload` for dev server
|
||||
ARG1=${1:-production}
|
||||
|
||||
# Get PUID/PGID
|
||||
PUID=${PUID:-911}
|
||||
PGID=${PGID:-911}
|
||||
|
||||
add_user() {
|
||||
groupmod -o -g "$PGID" abc
|
||||
usermod -o -u "$PUID" abc
|
||||
}
|
||||
|
||||
change_user() {
|
||||
# If container is started as root then create a new user and switch to it
|
||||
if [ "$(id -u)" = "0" ]; then
|
||||
add_user
|
||||
chown -R $PUID:$PGID /app
|
||||
|
||||
echo "Switching to dedicated user"
|
||||
exec gosu $PUID "$BASH_SOURCE" "$@"
|
||||
elif [ "$(id -u)" = $PUID ]; then
|
||||
echo "
|
||||
User uid: $PUID
|
||||
User gid: $PGID
|
||||
"
|
||||
fi
|
||||
}
|
||||
|
||||
init() {
|
||||
# $MEALIE_HOME directory
|
||||
cd /app
|
||||
|
||||
# Activate our virtual environment here
|
||||
. /opt/pysetup/.venv/bin/activate
|
||||
|
||||
# Initialize Database Prerun
|
||||
poetry run python /app/mealie/db/init_db.py
|
||||
}
|
||||
|
||||
echo "Production"
|
||||
|
||||
change_user
|
||||
|
||||
init
|
||||
|
||||
GUNICORN_PORT=${API_PORT:-9000}
|
||||
|
||||
# Start API
|
||||
|
||||
if [ "$WEB_GUNICORN" == 'true' ]; then
|
||||
echo "Starting Gunicorn"
|
||||
gunicorn mealie.app:app -b 0.0.0.0:$GUNICORN_PORT -k uvicorn.workers.UvicornWorker -c /app/gunicorn_conf.py --preload
|
||||
else
|
||||
uvicorn mealie.app:app --host 0.0.0.0 --port $GUNICORN_PORT
|
||||
fi
|
Loading…
Add table
Add a link
Reference in a new issue