From 0ca1b7e62e14bdbe58877c6cc50b7b9bd81076a4 Mon Sep 17 00:00:00 2001 From: bkellam Date: Wed, 5 Nov 2025 16:29:45 -0800 Subject: [PATCH] nits --- Dockerfile | 5 +++-- entrypoint.sh | 12 +++++------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index ce01bd4d..ddfb2925 100644 --- a/Dockerfile +++ b/Dockerfile @@ -247,8 +247,9 @@ RUN chmod +x ./prefix-output.sh COPY entrypoint.sh ./entrypoint.sh RUN chmod +x ./entrypoint.sh -# Default to root user, but can be overridden at runtime with --user flag -# No USER directive = runs as root by default +# Note: for back-compat cases, we do _not_ set the USER directive here. +# Instead, the user can be overridden at runtime with --user flag. +# USER sourcebot EXPOSE 3000 ENV PORT=3000 diff --git a/entrypoint.sh b/entrypoint.sh index 0f8ec7ed..ce9461f6 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -89,13 +89,13 @@ fi # Check if DATA_CACHE_DIR exists, if not create it if [ ! -d "$DATA_CACHE_DIR" ]; then - mkdir -m 0750 -p "$DATA_CACHE_DIR" + mkdir -p "$DATA_CACHE_DIR" fi # Check if DATABASE_DATA_DIR exists, if not initialize it if [ "$DATABASE_EMBEDDED" = "true" ] && [ ! -d "$DATABASE_DATA_DIR" ]; then echo -e "\e[34m[Info] Initializing database at $DATABASE_DATA_DIR...\e[0m" - mkdir -m 0750 -p $DATABASE_DATA_DIR + mkdir -p $DATABASE_DATA_DIR if [ "$IS_ROOT" = "true" ]; then chown -R postgres:postgres "$DATABASE_DATA_DIR" su postgres -c "initdb -D $DATABASE_DATA_DIR" @@ -106,7 +106,7 @@ fi # Create the redis data directory if it doesn't exist if [ "$REDIS_EMBEDDED" = "true" ] && [ ! -d "$REDIS_DATA_DIR" ]; then - mkdir -m 0750 -p $REDIS_DATA_DIR + mkdir -p $REDIS_DATA_DIR fi if [ -z "$SOURCEBOT_ENCRYPTION_KEY" ]; then @@ -221,7 +221,7 @@ if [ "$DATABASE_EMBEDDED" = "true" ]; then || createuser postgres -s fi - # Check if the database already exists, and create it if it doesn't + # Check if the database already exists, and create it if it doesn't exist EXISTING_DB=$(psql -U postgres -tAc "SELECT 1 FROM pg_database WHERE datname = 'sourcebot'") if [ "$EXISTING_DB" = "1" ]; then @@ -237,9 +237,7 @@ echo -e "\e[34m[Info] Running database migration...\e[0m" DATABASE_URL="$DATABASE_URL" yarn workspace @sourcebot/db prisma:migrate:prod # Create the log directory if it doesn't exist -if [ ! -d "/var/log/sourcebot" ]; then - mkdir -m 0750 -p /var/log/sourcebot -fi +mkdir -p /var/log/sourcebot # Run supervisord exec supervisord -c /etc/supervisor/conf.d/supervisord.conf \ No newline at end of file