Add non-root flutter user to all SDK images
All checks were successful
Check for Flutter SDK Updates / check-update (push) Successful in 2s

Creates a dedicated flutter user and switches to it as the default.
Resolves Docker Scout compliance check for non-root default user.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Mathias Beaulieu-Duncan 2026-02-02 01:42:45 -05:00
parent 301f8e7397
commit 35cc1cab34
3 changed files with 18 additions and 0 deletions

View File

@ -48,4 +48,10 @@ RUN flutter precache --web \
# Verify installation # Verify installation
RUN flutter doctor -v RUN flutter doctor -v
# Create non-root user for CI builds
RUN groupadd -r flutter && useradd -r -g flutter -m -d /home/flutter flutter && \
chown -R flutter:flutter "${FLUTTER_HOME}" /home/flutter
WORKDIR /app WORKDIR /app
RUN chown flutter:flutter /app
USER flutter

View File

@ -69,4 +69,10 @@ RUN flutter precache --android \
RUN flutter doctor -v RUN flutter doctor -v
# Create non-root user for CI builds
RUN groupadd -r flutter && useradd -r -g flutter -m -d /home/flutter flutter && \
chown -R flutter:flutter "${FLUTTER_HOME}" "${ANDROID_HOME}" /home/flutter
WORKDIR /app WORKDIR /app
RUN chown flutter:flutter /app
USER flutter

View File

@ -52,4 +52,10 @@ RUN flutter precache --linux \
RUN flutter doctor -v RUN flutter doctor -v
# Create non-root user for CI builds
RUN groupadd -r flutter && useradd -r -g flutter -m -d /home/flutter flutter && \
chown -R flutter:flutter "${FLUTTER_HOME}" /home/flutter
WORKDIR /app WORKDIR /app
RUN chown flutter:flutter /app
USER flutter