mirror of
https://github.com/gmeligio/flutter-docker-image.git
synced 2026-05-24 12:30:34 +00:00
build: add ENABLE_ANALYTICS to entrypoint
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
FLUTTER_VERSION=3.7.7
|
||||
ANDROID_BUILD_TOOLS_VERSION=30.0.3
|
||||
PLATFORMS_VERSIONS=28 31 33
|
||||
ENABLE_ANALYTICS=true
|
||||
@@ -69,6 +69,10 @@ RUN git clone --depth 1 --branch "$flutter_version" https://github.com/flutter/f
|
||||
&& flutter config --no-enable-macos-desktop \
|
||||
&& flutter doctor
|
||||
|
||||
COPY ./docker-entrypoint.sh /docker-entrypoint.sh
|
||||
|
||||
ENTRYPOINT [ "/docker-entrypoint.sh" ]
|
||||
|
||||
FROM flutter as android
|
||||
|
||||
LABEL org.opencontainers.image.source="https://github.com/gmeligio/flutter-docker-image" \
|
||||
|
||||
@@ -5,6 +5,8 @@ services:
|
||||
target: flutter
|
||||
args:
|
||||
flutter_version: $FLUTTER_VERSION
|
||||
environment:
|
||||
ENABLE_ANALYTICS: $ENABLE_ANALYTICS
|
||||
|
||||
android:
|
||||
build:
|
||||
@@ -14,6 +16,8 @@ services:
|
||||
flutter_version: $FLUTTER_VERSION
|
||||
android_build_tools_version: $ANDROID_BUILD_TOOLS_VERSION
|
||||
platforms_versions: $PLATFORMS_VERSIONS
|
||||
environment:
|
||||
ENABLE_ANALYTICS: $ENABLE_ANALYTICS
|
||||
|
||||
test:
|
||||
build:
|
||||
@@ -23,4 +27,6 @@ services:
|
||||
flutter_version: $FLUTTER_VERSION
|
||||
android_build_tools_version: $ANDROID_BUILD_TOOLS_VERSION
|
||||
platforms_versions: $PLATFORMS_VERSIONS
|
||||
environment:
|
||||
ENABLE_ANALYTICS: $ENABLE_ANALYTICS
|
||||
working_dir: /home/flutter/test_app/android
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
#!/bin/sh
|
||||
|
||||
analytic_tools_str="Dart and Flutter"
|
||||
|
||||
if [ "$ENABLE_ANALYTICS" = "true" ]; then
|
||||
echo "Received 'ENABLE_ANALYTICS=true'.\nEnabling analytics for $analytic_tools_str."
|
||||
dart --enable-analytics
|
||||
flutter config --analytics
|
||||
else
|
||||
echo "Analytics are opt-in and disabled by default in $analytic_tools_str.\nTo enable analytics, pass the environment variable 'ENABLE_ANALYTICS=true' when starting the container."
|
||||
fi
|
||||
|
||||
exec "$@"
|
||||
Reference in New Issue
Block a user