diff --git a/Dockerfile b/Dockerfile index 29abf9d..c314ea6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,14 +25,19 @@ ENV PUBLIC_VERSION=${VERSION} \ WORKDIR /app RUN apt-get update && \ - apt-get install -y ca-certificates gcc mime-support curl gzip unzip tar 7zip bzip2 unar && \ + apt-get install -y ca-certificates gcc bc locales mime-support curl gzip unzip tar 7zip bzip2 unar && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* +RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen +RUN locale-gen +ENV LANG=en_US.UTF-8 +ENV LC_ALL=en_US.UTF-8 + COPY pyproject.toml uv.lock ./ RUN uv sync --locked -COPY --chmod=755 mediamanager-backend-startup.sh . +COPY --chmod=755 mediamanager-startup.sh . COPY config.example.toml . COPY media_manager ./media_manager COPY alembic ./alembic @@ -42,4 +47,4 @@ COPY --from=frontend-build /frontend/build /app/web/build HEALTHCHECK CMD curl -f http://localhost:8000${BASE_PATH}/api/v1/health || exit 1 EXPOSE 8000 -CMD ["/app/mediamanager-backend-startup.sh"] +CMD ["/app/mediamanager-startup.sh"] diff --git a/mediamanager-backend-startup.sh b/mediamanager-backend-startup.sh deleted file mode 100644 index 8d9a1f6..0000000 --- a/mediamanager-backend-startup.sh +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/sh -# This script is used to start the MediaManager backend service. - - -# text created with https://patorjk.com/software/taag/ font: Slanted -echo " - __ ___ ___ __ ___ ____ __ __ - / |/ /__ ____/ (_)___ _/ |/ /___ _____ ____ _____ ____ _____ / __ )____ ______/ /_____ ____ ____/ / - / /|_/ / _ \/ __ / / __ \`/ /|_/ / __ \`/ __ \/ __ \`/ __ \`/ _ \/ ___/ / __ / __ \`/ ___/ //_/ _ \/ __ \/ __ / - / / / / __/ /_/ / / /_/ / / / / /_/ / / / / /_/ / /_/ / __/ / / /_/ / /_/ / /__/ ,< / __/ / / / /_/ / -/_/ /_/\___/\__,_/_/\__,_/_/ /_/\__,_/_/ /_/\__,_/\__, /\___/_/ /_____/\__,_/\___/_/|_|\___/_/ /_/\__,_/ - /____/ -" -echo "Buy me a coffee at https://buymeacoffee.com/maxdorninger" - -# Initialize config if it doesn't exist -CONFIG_DIR=${CONFIG_DIR:-/app/config} -CONFIG_FILE="$CONFIG_DIR/config.toml" -EXAMPLE_CONFIG="/app/config.example.toml" - -echo "Checking configuration setup..." - -# Create config directory if it doesn't exist -if [ ! -d "$CONFIG_DIR" ]; then - echo "Creating config directory: $CONFIG_DIR" - mkdir -p "$CONFIG_DIR" -fi - -# Copy example config if config.toml doesn't exist -if [ ! -f "$CONFIG_FILE" ]; then - echo "Config file not found. Copying example config to: $CONFIG_FILE" - if [ -f "$EXAMPLE_CONFIG" ]; then - cp "$EXAMPLE_CONFIG" "$CONFIG_FILE" - echo "Example config copied successfully!" - echo "Please edit $CONFIG_FILE to configure MediaManager for your environment." - echo "Important: Make sure to change the token_secret value!" - else - echo "ERROR: Example config file not found at $EXAMPLE_CONFIG" - exit 1 - fi -else - echo "Config file found at: $CONFIG_FILE" -fi - -echo "Running DB migrations..." - -uv run alembic upgrade head - -echo "Starting MediaManager backend service..." -echo "" -echo "🔐 LOGIN INFORMATION:" -echo " If this is a fresh installation, a default admin user will be created automatically." -echo " Check the application logs for the login credentials." -echo " You can also register a new user and it will become admin if the email" -echo " matches one of the admin_emails in your config.toml" -echo "" - -PORT=${PORT:-8000} -uv run fastapi run /app/media_manager/main.py --port "$PORT" --proxy-headers diff --git a/mediamanager-startup.sh b/mediamanager-startup.sh new file mode 100644 index 0000000..8614a37 --- /dev/null +++ b/mediamanager-startup.sh @@ -0,0 +1,151 @@ +#!/bin/bash +# This script is used to start the MediaManager backend service. + + +# text created with https://patorjk.com/software/taag/ font: Slanted +display_cool_text() { + local ascii_art="$1" + + local r_blue=80 + local g_blue=100 + local b_blue=230 + + local r_orange=255 + local g_orange=140 + local b_orange=80 + + local r_red=230 + local g_red=40 + local b_red=70 + + local max_width=0 + while IFS= read -r line; do + local line_length=${#line} + if (( line_length > max_width )); then + max_width=$line_length + fi + done <<< "$ascii_art" + + while IFS= read -r line; do + local length=${#line} + + if [[ $length -eq 0 ]]; then + echo "" + continue + fi + + local seg1=$((max_width / 2)) + + for (( i=0; i