|
@@ -33,9 +33,25 @@ COPY . ./
|
|
|
# Caddyfile and entrypoint
|
|
# Caddyfile and entrypoint
|
|
|
COPY docker/Caddyfile /etc/Caddyfile
|
|
COPY docker/Caddyfile /etc/Caddyfile
|
|
|
COPY docker/entrypoint.sh /usr/local/bin/entrypoint.sh
|
|
COPY docker/entrypoint.sh /usr/local/bin/entrypoint.sh
|
|
|
-RUN chmod +x /usr/local/bin/entrypoint.sh \
|
|
|
|
|
|
|
+
|
|
|
|
|
+# SEC_REVIEW F18: drop root. /app stays root-owned and world-readable
|
|
|
|
|
+# (the runtime only needs to read source); /data is app-owned so the
|
|
|
|
|
+# SQLite db, attached volume, and `auth:bootstrap-service-token`
|
|
|
|
|
+# writes succeed without root. /home/app/.{config,local/share} are
|
|
|
|
|
+# pre-created and owned so FrankenPHP/Caddy XDG state has somewhere
|
|
|
|
|
+# to land. apk + install-php-extensions still ran above as root
|
|
|
|
|
+# because they touch /usr/local; no further root-owned work remains.
|
|
|
|
|
+RUN addgroup -S -g 1000 app \
|
|
|
|
|
+ && adduser -S -u 1000 -G app -h /home/app app \
|
|
|
|
|
+ && chmod +x /usr/local/bin/entrypoint.sh \
|
|
|
&& chmod +x bin/console \
|
|
&& chmod +x bin/console \
|
|
|
- && mkdir -p /data
|
|
|
|
|
|
|
+ && mkdir -p /data /home/app/.config /home/app/.local/share \
|
|
|
|
|
+ && chown -R app:app /data /home/app
|
|
|
|
|
+
|
|
|
|
|
+ENV XDG_CONFIG_HOME=/home/app/.config \
|
|
|
|
|
+ XDG_DATA_HOME=/home/app/.local/share
|
|
|
|
|
+
|
|
|
|
|
+USER app
|
|
|
|
|
|
|
|
EXPOSE 8081
|
|
EXPOSE 8081
|
|
|
|
|
|