-
Notifications
You must be signed in to change notification settings - Fork 12
enh: add IGNORE_PERMISSIONS and hot restart to local development docker #833
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
almeidaraul
wants to merge
5
commits into
main
Choose a base branch
from
add-hot-reload-to-local-docker
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
c8f102a
enh: add IGNORE_PERMISSIONS and hot reload to local development docke…
almeidaraul ee55730
enh: copilot review
almeidaraul de4f124
fix: commited by accident config.py
almeidaraul b2ac7be
fix: IGNORE_PERMISSIONS for tests
almeidaraul 076548a
fix: mypy
almeidaraul File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| # Copyright 2025 Canonical Ltd. | ||
| # | ||
| # This program is free software: you can redistribute it and/or modify | ||
| # it under the terms of the GNU General Public License version 3, as | ||
| # published by the Free Software Foundation. | ||
| # This program is distributed in the hope that it will be useful, | ||
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| # GNU General Public License for more details. | ||
| # You should have received a copy of the GNU General Public License | ||
| # along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
| # | ||
| # SPDX-FileCopyrightText: Copyright 2025 Canonical Ltd. | ||
| # SPDX-License-Identifier: GPL-3.0-only | ||
|
|
||
| # Development image for the Test Observer frontend. | ||
| # | ||
| # Unlike the production Dockerfile, this image does NOT build a static release | ||
| # bundle. Instead the source is bind-mounted at runtime (see docker-compose.yml) | ||
| # and the container runs `flutter run` on a web server so that code changes are | ||
| # picked up without rebuilding the image. | ||
|
|
||
| FROM ubuntu:24.04 | ||
|
|
||
| ENV DEBIAN_FRONTEND=noninteractive | ||
| RUN apt-get update && \ | ||
| apt-get install -y \ | ||
| curl git wget unzip gdb libstdc++6 libglu1-mesa fonts-droid-fallback \ | ||
| python3 inotify-tools && \ | ||
| apt-get clean && \ | ||
| rm -rf /var/lib/apt/lists/* | ||
|
|
||
| RUN git clone --depth 1 --branch '3.29.3' https://github.com/flutter/flutter.git /opt/flutter && \ | ||
| /opt/flutter/bin/flutter doctor && \ | ||
| /opt/flutter/bin/flutter config --enable-web | ||
|
|
||
| ENV PATH="$PATH:/opt/flutter/bin:/root/.pub-cache/bin" | ||
|
|
||
| WORKDIR /app | ||
|
|
||
| # Warm the pub cache so the first `flutter run` is fast. The source itself is | ||
| # bind-mounted at runtime, so only dependency manifests are copied here. | ||
| COPY pubspec.* /app/ | ||
| RUN flutter pub get | ||
|
|
||
| # Copy the entrypoint into the image so it works even without the runtime | ||
| # bind-mount, and invoke it via `bash` so it doesn't depend on the executable | ||
| # bit being preserved. In docker-compose the bind-mount overrides this copy | ||
| # with the live host version. | ||
| COPY dev_entrypoint.sh /app/dev_entrypoint.sh | ||
|
|
||
| EXPOSE 80 | ||
|
|
||
| CMD ["bash", "/app/dev_entrypoint.sh"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| #!/bin/bash | ||
|
|
||
| # Copyright 2025 Canonical Ltd. | ||
| # | ||
| # This program is free software: you can redistribute it and/or modify | ||
| # it under the terms of the GNU General Public License version 3, as | ||
| # published by the Free Software Foundation. | ||
| # This program is distributed in the hope that it will be useful, | ||
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| # GNU General Public License for more details. | ||
| # You should have received a copy of the GNU General Public License | ||
| # along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
| # | ||
| # SPDX-FileCopyrightText: Copyright 2025 Canonical Ltd. | ||
| # SPDX-License-Identifier: GPL-3.0-only | ||
|
|
||
| set -e | ||
|
|
||
| echo "Fetching Flutter dependencies..." | ||
| flutter pub get | ||
|
|
||
| echo "Generating code (blocking, so *.g.dart / *.freezed.dart are fresh before first compile)..." | ||
| dart run build_runner build --delete-conflicting-outputs | ||
|
|
||
| echo "Starting build_runner in watch mode (regenerates code on subsequent changes)..." | ||
| dart run build_runner watch --delete-conflicting-outputs & | ||
|
|
||
| # Feed the Flutter dev server's stdin through a FIFO so we can drive it | ||
| # non-interactively. A file watcher writes "R" (hot restart) to the FIFO | ||
| # whenever a source file changes, giving automatic reload on save without | ||
| # needing to attach a TTY to the container. | ||
| FIFO=/tmp/flutter-stdin | ||
| rm -f "$FIFO" | ||
| mkfifo "$FIFO" | ||
| # Hold the FIFO open for writing so it never receives EOF. | ||
| exec 3<>"$FIFO" | ||
|
|
||
| echo "Watching lib/ and web/ for changes to trigger automatic hot restart..." | ||
| ( | ||
| while inotifywait -q -r -e modify,create,delete,move \ | ||
| --include '\.(dart|yaml|json|html)$' lib web >/dev/null 2>&1; do | ||
|
almeidaraul marked this conversation as resolved.
|
||
| # Debounce bursts of file events (e.g. build_runner regenerating files). | ||
| sleep 1 | ||
| echo "R" >&3 | ||
| done | ||
| ) & | ||
|
|
||
| echo "Starting Flutter web dev server (hot restart on save)..." | ||
| # --web-hostname 0.0.0.0 so the server is reachable from outside the container. | ||
|
almeidaraul marked this conversation as resolved.
|
||
| exec flutter run \ | ||
| -d web-server \ | ||
| --web-hostname 0.0.0.0 \ | ||
| --web-port 80 \ | ||
| <&3 | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the idea is to make local development easier, you can disable that if you want to test authorization
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can have different profiles in docker compose.