Skip to content

Commit 0ca1b7e

Browse files
nits
1 parent 4957de3 commit 0ca1b7e

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,9 @@ RUN chmod +x ./prefix-output.sh
247247
COPY entrypoint.sh ./entrypoint.sh
248248
RUN chmod +x ./entrypoint.sh
249249

250-
# Default to root user, but can be overridden at runtime with --user flag
251-
# No USER directive = runs as root by default
250+
# Note: for back-compat cases, we do _not_ set the USER directive here.
251+
# Instead, the user can be overridden at runtime with --user flag.
252+
# USER sourcebot
252253

253254
EXPOSE 3000
254255
ENV PORT=3000

entrypoint.sh

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,13 @@ fi
8989

9090
# Check if DATA_CACHE_DIR exists, if not create it
9191
if [ ! -d "$DATA_CACHE_DIR" ]; then
92-
mkdir -m 0750 -p "$DATA_CACHE_DIR"
92+
mkdir -p "$DATA_CACHE_DIR"
9393
fi
9494

9595
# Check if DATABASE_DATA_DIR exists, if not initialize it
9696
if [ "$DATABASE_EMBEDDED" = "true" ] && [ ! -d "$DATABASE_DATA_DIR" ]; then
9797
echo -e "\e[34m[Info] Initializing database at $DATABASE_DATA_DIR...\e[0m"
98-
mkdir -m 0750 -p $DATABASE_DATA_DIR
98+
mkdir -p $DATABASE_DATA_DIR
9999
if [ "$IS_ROOT" = "true" ]; then
100100
chown -R postgres:postgres "$DATABASE_DATA_DIR"
101101
su postgres -c "initdb -D $DATABASE_DATA_DIR"
@@ -106,7 +106,7 @@ fi
106106

107107
# Create the redis data directory if it doesn't exist
108108
if [ "$REDIS_EMBEDDED" = "true" ] && [ ! -d "$REDIS_DATA_DIR" ]; then
109-
mkdir -m 0750 -p $REDIS_DATA_DIR
109+
mkdir -p $REDIS_DATA_DIR
110110
fi
111111

112112
if [ -z "$SOURCEBOT_ENCRYPTION_KEY" ]; then
@@ -221,7 +221,7 @@ if [ "$DATABASE_EMBEDDED" = "true" ]; then
221221
|| createuser postgres -s
222222
fi
223223

224-
# Check if the database already exists, and create it if it doesn't
224+
# Check if the database already exists, and create it if it doesn't exist
225225
EXISTING_DB=$(psql -U postgres -tAc "SELECT 1 FROM pg_database WHERE datname = 'sourcebot'")
226226

227227
if [ "$EXISTING_DB" = "1" ]; then
@@ -237,9 +237,7 @@ echo -e "\e[34m[Info] Running database migration...\e[0m"
237237
DATABASE_URL="$DATABASE_URL" yarn workspace @sourcebot/db prisma:migrate:prod
238238

239239
# Create the log directory if it doesn't exist
240-
if [ ! -d "/var/log/sourcebot" ]; then
241-
mkdir -m 0750 -p /var/log/sourcebot
242-
fi
240+
mkdir -p /var/log/sourcebot
243241

244242
# Run supervisord
245243
exec supervisord -c /etc/supervisor/conf.d/supervisord.conf

0 commit comments

Comments
 (0)