Skip to content

Commit d9ea4b8

Browse files
dotMavriQclaude
andcommitted
fix: handle serversideup non-root user for extension install and permissions
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent e424e7f commit d9ea4b8

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

Dockerfile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,23 +56,21 @@ LABEL maintainer="dotmavriq" \
5656
app="TEAL" \
5757
description="TEAL - Track Everything About Life"
5858

59-
# ---- Install additional PHP extensions ----
59+
# ---- Install additional PHP extensions (requires root) ----
6060
# pgsql/pdo_pgsql: PostgreSQL
6161
# gd: Image processing (intervention/image)
6262
# intl: Unicode/i18n support
63-
# opcache: Production PHP performance
64-
# pcntl: Process control for Octane graceful shutdown
6563
# bcmath: Precision math (Laravel dependency)
64+
# Note: pdo_pgsql, opcache, pcntl already included in serversideup image
65+
USER root
6666
RUN install-php-extensions \
67-
pdo_pgsql \
6867
pgsql \
6968
gd \
7069
intl \
71-
opcache \
72-
pcntl \
7370
bcmath \
7471
&& echo "[production] PHP extensions installed:" \
7572
&& php -m | sort
73+
USER www-data
7674

7775
# ---- Set environment defaults ----
7876
ENV APP_ENV=production \
@@ -100,6 +98,7 @@ RUN composer dump-autoload --optimize --no-dev \
10098
&& echo "[production] Autoloader optimized"
10199

102100
# ---- Ensure storage directories and permissions ----
101+
USER root
103102
RUN mkdir -p \
104103
storage/app/public/covers \
105104
storage/framework/cache/data \
@@ -115,6 +114,7 @@ RUN mkdir -p \
115114
COPY docker/entrypoint.sh /usr/local/bin/docker-entrypoint.sh
116115
COPY docker/queue-entrypoint.sh /usr/local/bin/docker-queue-entrypoint.sh
117116
RUN chmod +x /usr/local/bin/docker-entrypoint.sh /usr/local/bin/docker-queue-entrypoint.sh
117+
USER www-data
118118

119119
# ---- Healthcheck ----
120120
HEALTHCHECK --interval=15s --timeout=5s --retries=3 --start-period=20s \

docker/entrypoint.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@ mkdir -p \
5252
storage/logs \
5353
bootstrap/cache
5454

55-
# Fix ownership if running as root (serversideup images handle this)
55+
# Fix permissions (may not be able to chown as non-root, that's fine)
5656
if [ "$(id -u)" = "0" ]; then
5757
chown -R www-data:www-data storage bootstrap/cache
5858
fi
59-
chmod -R 775 storage bootstrap/cache
59+
chmod -R 775 storage bootstrap/cache 2>/dev/null || true
6060
log "Storage directories ready"
6161

6262
# ---- Step 4: Create storage:link symlink ----

0 commit comments

Comments
 (0)