Skip to content

build: fix Docker and Dev Container Flutter 3.29 build error#2542

Merged
CharlVS merged 4 commits intodevfrom
build/fix-docker-devcontainer
Feb 25, 2025
Merged

build: fix Docker and Dev Container Flutter 3.29 build error#2542
CharlVS merged 4 commits intodevfrom
build/fix-docker-devcontainer

Conversation

@takenagain
Copy link
Copy Markdown
Contributor

@takenagain takenagain commented Feb 20, 2025

  • Removes the KDF build step from Docker builds, as it is now managed by the SDK, and will require significant changes to work with the new structure (i.e. cloning the SDK to modify build_config.json to disable KDF downloads).
  • Migrates the Flutter install steps to download from the SDK archive rather than cloning with git. This is to mitigate the 3.29 bug when installing flutter via git clone, and because the official documentation now recommends using the SDK archive or IDE extensions to download flutter.

Open in GitHub Codespaces

NOTE: the Dev Container setup takes ownership of the project directory, so you might need to run sudo chown -R $USER:$USER ./ if you are switching between local files and dev containers.

Summary by CodeRabbit

  • New Features
    • Enhanced the development container for Flutter and Android with updated configuration, dynamic volume mounts, and forwarded ports for improved connectivity.
  • Chores
    • Removed the legacy environment setup script in favor of streamlined commands.
    • Upgraded Android SDK components (platform version, build tools, and NDK) and optimized the Flutter setup by directly downloading the pre-built SDK.
    • Refined the build context by excluding unnecessary directories.

@takenagain takenagain added the bug Something isn't working label Feb 20, 2025
@takenagain takenagain self-assigned this Feb 20, 2025
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Feb 20, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

This pull request revamps the development environment configuration for Flutter and Android. A new Dockerfile is introduced while several outdated scripts and Dockerfiles are removed. The devcontainer configuration is updated to reference the new Dockerfile, modify post-attach and post-create commands, add bind mounts and port forwarding, and remove host constraints. Additionally, the Android SDK Dockerfile and build scripts have been updated to use newer version numbers, and the Komodo wallet Android Dockerfile now downloads the Flutter SDK directly.

Changes

Files Change Summary
.devcontainer Files:
.devcontainer/Dockerfile
.devcontainer/dev-setup.sh (deleted)
.devcontainer/devcontainer.json
.devcontainer/komodo-wallet-android-dev.dockerfile (deleted)
Introduced a new Dockerfile for Flutter/Android development; removed the old setup script and Dockerfile; updated container configuration to reference the new Dockerfile, adjust commands (postAttachCommand to "flutter pub get"), add mounts, port forwarding, and permission commands, and remove hostRequirements.
Android SDK & Build Files:
.docker/android-sdk.dockerfile
.docker/build.sh
Updated Android SDK parameters: ANDROID_PLATFORM_VERSION from 34 to 35, ANDROID_BUILD_TOOLS_VERSION from 34.0.0 to 35.0.1, ANDROID_NDK_VERSION from 26.3.11579264 to 27.2.12479018; modified build script with adjusted OS comparison and shell command changes, plus image version update.
Komodo Wallet Dockerfile:
.docker/komodo-wallet-android.dockerfile
Changed base image from komodo/android-sdk:34 to komodo/android-sdk:35; removed obsolete environment variables; updated PATH to use the new HOME setting; streamlined Flutter setup by replacing repository clone with a direct download of the Flutter SDK.
Other:
.docker/kdf-android.dockerfile (deleted)
.dockerignore
Removed an obsolete Dockerfile and added ignore patterns for .git, build, and .fvm directories to optimize the Docker build context.

Sequence Diagram(s)

sequenceDiagram
    participant Dev as Developer
    participant Docker as Docker Engine
    participant Container as Dev Container

    Dev->>Docker: Initiate build using new Dockerfile
    Docker->>Container: Execute sequential RUN commands for system setup
    Container->>Container: Install dependencies (Android SDK, Flutter SDK, libraries) & configure user/environment
    Dev->>Container: Run postCreateCommand to set permissions
    Dev->>Container: Run postAttachCommand ("flutter pub get")
    Container-->>Dev: Development environment ready
Loading

Possibly related PRs

Suggested labels

CI

Suggested reviewers

  • smk762
  • CharlVS

Poem

I'm a rabbit with lines of code so neat,
Hopping through Docker builds with a joyful beat.
Flutter and Android now sing a sweeter tune,
With cleaner setups under a digital moon.
Cheers to changes—hop, skip, and code on! 🐰


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@takenagain
Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Feb 20, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Feb 20, 2025

Visit the preview URL for this PR (updated for commit fbdc78f):

https://walletrc--pull-2542-merge-f7fdg6ze.web.app

(expires Thu, 27 Feb 2025 16:00:50 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: f66a4ff03faa546f12f0ae5a841bd9eff2714dcc

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (5)
.docker/komodo-wallet-android.dockerfile (1)

13-18: Flutter SDK Installation Update – Consider Integrity Verification
The new RUN block downloads and extracts the Flutter SDK directly. While this simplifies the process by removing the cloning step, it may be beneficial to add a checksum verification after download for enhanced security and reliability.

.docker/build.sh (1)

31-33: Quote Command Substitution for User ID
The -u $(id -u):$(id -g) option in the docker run command should be quoted to prevent potential word splitting. For example:

-  -u $(id -u):$(id -g) \
+  -u "$(id -u):$(id -g)" \
🧰 Tools
🪛 Shellcheck (0.10.0)

[warning] 31-31: Quote this to prevent word splitting.

(SC2046)


[warning] 31-31: Quote this to prevent word splitting.

(SC2046)

.devcontainer/Dockerfile (3)

1-9: Environment Variable Setup and PATH Concatenation
The Dockerfile sets key environment variables for Flutter and the Android SDK. The successive modifications to the PATH (adding $HOME/flutter/bin, /android-ndk/bin, and later the Android SDK tools) are cumulative but could be consolidated into a single ENV statement for improved readability.


73-99: Avoid Using Sudo in RUN Instructions
The RUN block that sets up the Android command-line tools uses sudo (e.g., sudo chown -R $USER:$USER /opt). According to best practices and Hadolint recommendations, consider replacing sudo with a tool like gosu to drop privileges more predictably. For instance:

-    && sudo chown -R $USER:$USER /opt \
+    && gosu $USER chown -R $USER:$USER /opt \

This change can help avoid potential issues related to sudo’s behavior in containerized environments.

🧰 Tools
🪛 Hadolint (2.12.0)

[error] 73-73: Do not use sudo as it leads to unpredictable behavior. Use a tool like gosu to enforce root

(DL3004)


108-117: Flutter SDK Download – Consider Checksum Verification
Similar to the approach in the Android image, the Flutter SDK download (via curl and extraction) might benefit from an additional checksum verification step to ensure the integrity and authenticity of the downloaded archive before extraction.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c4b67e8 and a0772ca.

📒 Files selected for processing (9)
  • .devcontainer/Dockerfile (1 hunks)
  • .devcontainer/dev-setup.sh (0 hunks)
  • .devcontainer/devcontainer.json (1 hunks)
  • .devcontainer/komodo-wallet-android-dev.dockerfile (0 hunks)
  • .docker/android-sdk.dockerfile (1 hunks)
  • .docker/build.sh (1 hunks)
  • .docker/kdf-android.dockerfile (0 hunks)
  • .docker/komodo-wallet-android.dockerfile (1 hunks)
  • .dockerignore (1 hunks)
💤 Files with no reviewable changes (3)
  • .devcontainer/dev-setup.sh
  • .docker/kdf-android.dockerfile
  • .devcontainer/komodo-wallet-android-dev.dockerfile
✅ Files skipped from review due to trivial changes (1)
  • .dockerignore
🧰 Additional context used
🪛 Shellcheck (0.10.0)
.docker/build.sh

[warning] 31-31: Quote this to prevent word splitting.

(SC2046)


[warning] 31-31: Quote this to prevent word splitting.

(SC2046)

🪛 Hadolint (2.12.0)
.devcontainer/Dockerfile

[error] 73-73: Do not use sudo as it leads to unpredictable behavior. Use a tool like gosu to enforce root

(DL3004)

🔇 Additional comments (11)
.docker/komodo-wallet-android.dockerfile (1)

1-6: Base Image and Environment Variables Update
The update to use FROM komodo/android-sdk:35 AS final and the removal of the FLUTTER_HOME variable (with PATH now utilizing $HOME) is clear and consistent with the updated Docker setup.

.docker/build.sh (2)

19-23: Platform Detection on Darwin
The conditional using if [ "$(uname)" = "Darwin" ]; then is straightforward and correctly sets the PLATFORM_FLAG for macOS environments.


25-25: Updated Docker Build Command for Android SDK
The Docker build command now targets komodo/android-sdk:35, which aligns with the other configuration updates. This looks correct.

.devcontainer/devcontainer.json (5)

4-4: Updated Dockerfile Reference
Changing "dockerFile": "komodo-wallet-android-dev.dockerfile" to "Dockerfile" is clear and aligns with the updated Docker setup.


6-8: Mount Configuration Added
The new bind mount configuration ensures that the local workspace is correctly mapped to the container’s workspace. This change should help maintain file consistency during development.


10-11: Post-Create and Post-Attach Commands Update
Replacing the previous setup script with a direct postAttachCommand (flutter pub get) and adding a postCreateCommand to adjust ownership and permissions streamline the container setup.


12-20: Run Arguments and Port Forwarding Configuration
The added run arguments (with --privileged and USB device mounting) and the forwardPorts settings (8081 and 5037) are well configured for the environment needs.


23-25: Extension Configuration Update
The customization to include the Dart-Code.flutter extension (while keeping essential Dart extensions) is correct and supports Flutter development.

.docker/android-sdk.dockerfile (1)

28-33: Android SDK and NDK Version Bump
The updates to set ANDROID_PLATFORM_VERSION=35, ANDROID_BUILD_TOOLS_VERSION=35.0.1, and ANDROID_NDK_VERSION=27.2.12479018 are consistent with the other version updates across the configuration files. Ensure these versions are thoroughly tested with your build pipeline.

.devcontainer/Dockerfile (2)

31-37: User Creation and Permission Configuration
The section that installs sudo, creates the komodo user, and adjusts ownership using chown is standard. However, since you’re running subsequent commands as the non-root user, consider whether these sudo commands are strictly necessary.


38-68: Dependency Installation Block
The installation commands for additional packages and dependencies are comprehensive. The cleanup steps help keep the image lean. No issues were detected here.

@takenagain takenagain changed the title build: fix Docker and Dev Container configurations build: fix Docker and Dev Container Flutter 3.29 build error Feb 20, 2025
@takenagain takenagain marked this pull request as ready for review February 20, 2025 16:03
Copy link
Copy Markdown
Collaborator

@CharlVS CharlVS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As tested by @DeckerSU

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants