1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-07-24 15:49:42 +02:00
mealie/docker/entry.sh
Michael Chisholm c0ab7673ba
dev: Create a Python package, build Docker images from it (#4551)
Co-authored-by: Kuchenpirat <24235032+Kuchenpirat@users.noreply.github.com>
Co-authored-by: Michael Genson <71845777+michael-genson@users.noreply.github.com>
Co-authored-by: Hayden <64056131+hay-kot@users.noreply.github.com>
2025-02-11 09:28:40 -06:00

44 lines
818 B
Bash

#!/bin/bash
# Start Backend API
# Get PUID/PGID
PUID=${PUID:-911}
PGID=${PGID:-911}
BASH_SOURCE=${BASH_SOURCE:-$0}
add_user() {
groupmod -o -g "$PGID" abc
usermod -o -u "$PUID" abc
}
change_user() {
if [ "$(id -u)" = $PUID ]; then
echo "
User uid: $PUID
User gid: $PGID
"
elif [ "$(id -u)" = "0" ]; then
# If container is started as root then create a new user and switch to it
add_user
chown -R $PUID:$PGID /app
echo "Switching to dedicated user"
exec gosu $PUID "$BASH_SOURCE" "$@"
fi
}
init() {
# $MEALIE_HOME directory
cd /app
# Activate our virtual environment here
. /opt/mealie/bin/activate
}
change_user
init
# Start API
HOST_IP=`/sbin/ip route|awk '/default/ { print $3 }'`
exec mealie