Skip to content

Add Dockerfile for containerization and enhance demo mode logic#401

Merged
wess09 merged 2 commits into
masterfrom
dev
Jun 26, 2026
Merged

Add Dockerfile for containerization and enhance demo mode logic#401
wess09 merged 2 commits into
masterfrom
dev

Conversation

@wess09

@wess09 wess09 commented Jun 26, 2026

Copy link
Copy Markdown
Owner

由 Sourcery 提供的摘要

在演示模式下新增容器化支持并调整 WebUI 行为,同时改进全屏模式下的方向处理。

新功能:

  • 引入顶层 Dockerfile,用于将应用容器化,并预先配置 Python 虚拟环境和所需的系统工具。

错误修复:

  • 在演示模式运行时,阻止公共 WebUI 的密码错误弹窗和强制校验。
  • 改进全屏实时预览行为:进入全屏时锁定为横屏方向,退出时恢复原始方向,并包含对竖屏场景的专门处理。

增强改进:

  • 使现有 Docker 部署的路径和环境与 AzurPilot 目录结构对齐。
Original summary in English

Summary by Sourcery

Add containerization support and adjust WebUI behavior in demo mode while improving fullscreen orientation handling.

New Features:

  • Introduce a top-level Dockerfile to containerize the application with a preconfigured Python virtual environment and required system tools.

Bug Fixes:

  • Prevent public WebUI password error popups and enforcement when running in demo mode.
  • Improve fullscreen live preview behavior by locking orientation to landscape on entry and restoring orientation on exit, including portrait-specific handling.

Enhancements:

  • Align existing Docker deployment paths and environment with the AzurPilot directory structure.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@wess09 wess09 merged commit 267a152 into master Jun 26, 2026
7 checks passed
@sourcery-ai

sourcery-ai Bot commented Jun 26, 2026

Copy link
Copy Markdown

审阅者指南

添加顶层 Dockerfile 以支持容器化,修复现有 Docker 镜像路径,并增强 WebUI 的演示模式和直播预览的全屏方向处理。

全屏直播预览方向锁定顺序图

sequenceDiagram
    actor User
    participant WebUI
    participant Panel
    participant ScreenOrientation

    User->>WebUI: enterFullscreenControl()
    WebUI->>Panel: requestFullscreen()
    Panel-->>WebUI: Promise resolved
    WebUI->>WebUI: lockLandscape()
    WebUI->>ScreenOrientation: lock('landscape')

    User->>WebUI: exitFullscreenControl()
    WebUI->>WebUI: unlockOrientation()
    WebUI->>ScreenOrientation: unlock()
Loading

文件级变更

Change Details Files
在进入全屏时强制直播预览使用横向(landscape)方向,并在退出时恢复原始方向。
  • 新增仅在纵向(portrait)方向下生效的 CSS 规则,用于在全屏模式中请求横向显示。
  • 引入辅助函数,通过 Screen Orientation API(包含厂商兼容回退以及安全的错误处理)来锁定和解锁屏幕方向。
  • 在进入全屏控制时触发方向锁定,并在退出全屏控制时解除方向锁定。
assets/gui/js/alas-utils.js
调整 WebUI 在演示环境中的行为,在演示模式下绕过密码强制校验,同时在其他环境中保持正常密码处理逻辑。
  • 新增 is_demo_mode 辅助函数,通过读取 DEMO 环境变量来检测是否处于演示模式。
  • 在演示模式下,通过直接返回提供的密钥而不进行校验,来短路公共 WebUI 的密码强制逻辑。
  • 在演示模式下抑制与密码相关的阻塞式弹窗,同时在正常环境中仍保留这些弹窗。
module/webui/app.py
提供新的顶层 Dockerfile,并使现有 Docker 构建/运行配置与 AzurPilot 应用布局和 venv 位置保持一致。
  • 更新现有部署用 Dockerfile,将工作目录设置为 /app/AzurPilot,并相应调整 PATH,包括修正示例 docker run 命令中的卷挂载路径。
  • 在仓库根目录新增 Dockerfile,构建基于 Python 3.14-slim 的镜像,配置带代理支持的 uv,安装运行时依赖(git、adb、图形/库、ssh 客户端),并在 /app/AzurPilot/.venv 下创建可重定位的 virtualenv。
  • 在容器内配置 git 代理和 safe.directory 设置,将完整项目拷贝进镜像,并将默认命令设置为通过 venv 的 Python 解释器运行 gui.py。
deploy/docker/Dockerfile
Dockerfile

技巧与命令

与 Sourcery 交互

  • 触发新的审阅: 在 Pull Request 中评论 @sourcery-ai review
  • 继续讨论: 直接回复 Sourcery 的审阅评论。
  • 从审阅评论生成 GitHub issue: 在审阅评论下回复,要求 Sourcery 从该评论创建 issue。你也可以直接回复 @sourcery-ai issue,从该评论创建 issue。
  • 生成 Pull Request 标题: 在 Pull Request 标题的任意位置写上 @sourcery-ai,即可在任意时间生成标题。你也可以在 Pull Request 中评论 @sourcery-ai title,在任意时间(重新)生成标题。
  • 生成 Pull Request 摘要: 在 Pull Request 正文的任意位置写上 @sourcery-ai summary,即可在任意位置生成 PR 摘要。你也可以在 Pull Request 中评论 @sourcery-ai summary,在任意时间(重新)生成摘要。
  • 生成审阅者指南: 在 Pull Request 中评论 @sourcery-ai guide,即可在任意时间(重新)生成审阅者指南。
  • 一次性解决所有 Sourcery 评论: 在 Pull Request 中评论 @sourcery-ai resolve,即可将所有 Sourcery 评论标记为已解决。如果你已经处理完所有评论且不希望再看到它们,这会很有用。
  • 一次性撤销所有 Sourcery 审阅: 在 Pull Request 中评论 @sourcery-ai dismiss,即可撤销所有现有的 Sourcery 审阅。特别适用于你想从头开始新的审阅时 —— 记得再次评论 @sourcery-ai review 以触发新的审阅!

自定义你的体验

访问你的 控制面板 以:

  • 启用或禁用审阅功能,如 Sourcery 自动生成的 Pull Request 摘要、审阅者指南等。
  • 更改审阅语言。
  • 添加、删除或编辑自定义审阅说明。
  • 调整其他审阅设置。

获取帮助

Original review guide in English

Reviewer's Guide

Adds a top-level Dockerfile for containerization, fixes existing Docker image paths, and enhances WebUI demo mode and fullscreen orientation handling for the live preview.

Sequence diagram for fullscreen live preview orientation lock

sequenceDiagram
    actor User
    participant WebUI
    participant Panel
    participant ScreenOrientation

    User->>WebUI: enterFullscreenControl()
    WebUI->>Panel: requestFullscreen()
    Panel-->>WebUI: Promise resolved
    WebUI->>WebUI: lockLandscape()
    WebUI->>ScreenOrientation: lock('landscape')

    User->>WebUI: exitFullscreenControl()
    WebUI->>WebUI: unlockOrientation()
    WebUI->>ScreenOrientation: unlock()
Loading

File-Level Changes

Change Details Files
Enforce landscape orientation for the live preview when entering fullscreen and restore orientation on exit.
  • Add a portrait-orientation-specific CSS rule to request landscape orientation in fullscreen mode.
  • Introduce helper functions to lock and unlock screen orientation using the Screen Orientation API with vendor fallbacks and safe error handling.
  • Invoke orientation lock on entering fullscreen control and unlock on exiting fullscreen.
assets/gui/js/alas-utils.js
Adjust WebUI behavior in demo environments to bypass password enforcement while still allowing normal password handling elsewhere.
  • Introduce an is_demo_mode helper that reads the DEMO environment variable to detect demo mode.
  • Short-circuit public WebUI password enforcement in demo mode by returning the provided key without validation.
  • Suppress password-related blocking popups in demo mode while preserving them in normal environments.
module/webui/app.py
Provide a new top-level Dockerfile and align existing Docker build/run configuration with the AzurPilot app layout and venv location.
  • Update the existing deploy Dockerfile to use /app/AzurPilot as the working directory and adjust PATH accordingly, including fixing the sample docker run command volume mount path.
  • Add a new repository-root Dockerfile that builds a Python 3.14-slim-based image, wires up uv with proxy support, installs runtime dependencies (git, adb, graphics/libs, ssh client), and creates a relocatable virtualenv under /app/AzurPilot/.venv.
  • Configure git proxy and safe.directory settings inside the container, copy the full project into the image, and set the default command to run gui.py via the venv Python interpreter.
deploy/docker/Dockerfile
Dockerfile

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a Dockerfile using uv for dependency management, adds orientation locking to landscape mode when entering fullscreen in the WebUI preview, and implements a demo mode to bypass public WebUI password checks. The reviewer identified several issues: the Dockerfile uses a non-existent Python 3.14 base image and an unsupported '--relocatable' flag for 'uv venv', the CSS changes include an invalid 'orientation' property, and the demo mode logic should return 'None, None' to fully bypass the password prompt.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread Dockerfile
# docker build -t hgjazhgj/alas:latest -f deploy/docker/Dockerfile .
# docker run -v ${PWD}:/app/AzurPilot -p 25548:25548 --name AzurPilot -it --rm hgjazhgj/alas

FROM python:3.14-slim-bookworm

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

Python 3.14 is not yet released as a stable version, and the official python:3.14-slim-bookworm image does not exist on Docker Hub. This will cause the Docker build to fail. Please use a stable Python version such as 3.12 or 3.11.

FROM python:3.12-slim-bookworm

Comment thread Dockerfile
Comment on lines +48 to +53
RUN uv venv --relocatable --python /usr/local/bin/python .venv && \
uv sync --frozen --no-dev --no-install-project && \
cp /usr/local/bin/uv .venv/bin/uv && \
cp /usr/bin/adb .venv/bin/adb && \
cp /usr/bin/git .venv/bin/git && \
rm -rf /root/.cache/uv

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

The uv venv command does not support the --relocatable option, which will cause the Docker build to fail. Additionally, copying the uv, adb, and git binaries into .venv/bin/ duplicates these files and unnecessarily increases the Docker image size. Since these utilities are already in the system PATH, they can be symlinked instead of copied to save space.

RUN uv venv --python /usr/local/bin/python .venv && \
    uv sync --frozen --no-dev --no-install-project && \
    ln -s /usr/local/bin/uv .venv/bin/uv && \
    ln -s /usr/bin/adb .venv/bin/adb && \
    ln -s /usr/bin/git .venv/bin/git && \
    rm -rf /root/.cache/uv

Comment on lines 258 to 260
'#alas-live-preview:fullscreen{width:100vw;height:100vh;right:auto;bottom:auto;border:0;border-radius:0;background:#000;}',
'@media (orientation: portrait){#alas-live-preview:fullscreen{orientation:landscape;}}',
'#alas-live-preview:fullscreen .alas-live-preview-head{position:absolute;left:0;right:0;top:0;z-index:2;background:rgba(14,19,25,.86);}',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The CSS property orientation does not exist. Inside a CSS rule, orientation: landscape; is invalid and will be ignored by the browser. Since orientation locking is already handled programmatically via the Screen Orientation API in JavaScript (using screen.orientation.lock), this invalid CSS rule should be removed.

Suggested change
'#alas-live-preview:fullscreen{width:100vw;height:100vh;right:auto;bottom:auto;border:0;border-radius:0;background:#000;}',
'@media (orientation: portrait){#alas-live-preview:fullscreen{orientation:landscape;}}',
'#alas-live-preview:fullscreen .alas-live-preview-head{position:absolute;left:0;right:0;top:0;z-index:2;background:rgba(14,19,25,.86);}',
'#alas-live-preview:fullscreen{width:100vw;height:100vh;right:auto;bottom:auto;border:0;border-radius:0;background:#000;}',
'#alas-live-preview:fullscreen .alas-live-preview-head{position:absolute;left:0;right:0;top:0;z-index:2;background:rgba(14,19,25,.86);}',

Comment thread module/webui/app.py
Comment on lines +222 to +223
if is_demo_mode():
return key, None

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

In demo mode, the WebUI is typically intended to be publicly accessible without authentication. However, returning key, None means that if a password is set in the configuration or passed via arguments, the application will still prompt visitors for a password. To ensure the demo mode is fully public and bypasses the login screen, consider returning None, None when is_demo_mode() is active.

Suggested change
if is_demo_mode():
return key, None
if is_demo_mode():
return None, None

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - 我发现了 1 个问题,并给出了一些整体性的反馈:

  • 新增的 CSS 规则 @media (orientation: portrait){#alas-live-preview:fullscreen{orientation:landscape;}} 使用了非标准的 orientation 属性,大多数浏览器会忽略它;如果你的意图只是进行视觉上的调整,建议改用布局相关属性(例如 width/height/transform),或者完全依赖 screen.orientation.lock 的逻辑来实现。
  • 方向锁只在 exitFullscreenControl() 中被释放,因此如果用户通过浏览器自身的 UI(例如 ESC 键或内置控件)退出全屏,而没有经过这条代码路径,unlockOrientation() 可能永远不会被调用;建议监听 document.onfullscreenchange 来检测并处理所有退出全屏的路径。
  • 新增的顶层 Dockerfile 中的头部注释仍然引用使用 -f deploy/docker/Dockerfile 来构建,这在现在存在两个 Dockerfile 的情况下会让人困惑;建议更新示例命令,明确说明如何使用这个特定的 Dockerfile 进行构建/运行,并将其与 deploy/docker/Dockerfile 区分开来。
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new CSS rule `@media (orientation: portrait){#alas-live-preview:fullscreen{orientation:landscape;}}` uses a non-standard `orientation` property that most browsers will ignore; if the intent is purely visual adjustment, consider using layout properties (e.g., width/height/transform) or rely solely on the `screen.orientation.lock` logic instead.
- The orientation lock is only released in `exitFullscreenControl()`, so if the user exits fullscreen through the browser UI (e.g., ESC key or built-in controls) without going through this path, `unlockOrientation()` may never run; consider listening to `document.onfullscreenchange` to detect and handle all fullscreen exit paths.
- The header comments in the new top-level Dockerfile still reference building with `-f deploy/docker/Dockerfile`, which is confusing now that there are two Dockerfiles; it would be clearer to update the example commands to show how to build/run using this specific Dockerfile and to distinguish it from `deploy/docker/Dockerfile`.

## Individual Comments

### Comment 1
<location path="Dockerfile" line_range="1-2" />
<code_context>
+# docker build -t hgjazhgj/alas:latest -f deploy/docker/Dockerfile .
+# docker run -v ${PWD}:/app/AzurPilot -p 25548:25548 --name AzurPilot -it --rm hgjazhgj/alas
+
</code_context>
<issue_to_address>
**suggestion:** The build command in the root Dockerfile comment points to the deploy Dockerfile, which is confusing.

Since this Dockerfile is at the repo root, the example build command using `-f deploy/docker/Dockerfile` is ambiguous about which Dockerfile should be used. Please either update the example to reference this file (e.g. `-f Dockerfile`) or explicitly document that this is an alternative to `deploy/docker/Dockerfile` with its own build command.

```suggestion
# Example build using this root Dockerfile:
# docker build -t hgjazhgj/alas:latest -f Dockerfile .
#
# Alternatively, build using the deploy Dockerfile:
# docker build -t hgjazhgj/alas:latest -f deploy/docker/Dockerfile .
#
# Example run:
# docker run -v ${PWD}:/app/AzurPilot -p 25548:25548 --name AzurPilot -it --rm hgjazhgj/alas
```
</issue_to_address>

Sourcery 对开源项目是免费的 - 如果你觉得我们的评审有帮助,欢迎分享 ✨
帮我变得更有用!请对每条评论点 👍 或 👎,我会根据你的反馈改进后续的评审。
Original comment in English

Hey - I've found 1 issue, and left some high level feedback:

  • The new CSS rule @media (orientation: portrait){#alas-live-preview:fullscreen{orientation:landscape;}} uses a non-standard orientation property that most browsers will ignore; if the intent is purely visual adjustment, consider using layout properties (e.g., width/height/transform) or rely solely on the screen.orientation.lock logic instead.
  • The orientation lock is only released in exitFullscreenControl(), so if the user exits fullscreen through the browser UI (e.g., ESC key or built-in controls) without going through this path, unlockOrientation() may never run; consider listening to document.onfullscreenchange to detect and handle all fullscreen exit paths.
  • The header comments in the new top-level Dockerfile still reference building with -f deploy/docker/Dockerfile, which is confusing now that there are two Dockerfiles; it would be clearer to update the example commands to show how to build/run using this specific Dockerfile and to distinguish it from deploy/docker/Dockerfile.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new CSS rule `@media (orientation: portrait){#alas-live-preview:fullscreen{orientation:landscape;}}` uses a non-standard `orientation` property that most browsers will ignore; if the intent is purely visual adjustment, consider using layout properties (e.g., width/height/transform) or rely solely on the `screen.orientation.lock` logic instead.
- The orientation lock is only released in `exitFullscreenControl()`, so if the user exits fullscreen through the browser UI (e.g., ESC key or built-in controls) without going through this path, `unlockOrientation()` may never run; consider listening to `document.onfullscreenchange` to detect and handle all fullscreen exit paths.
- The header comments in the new top-level Dockerfile still reference building with `-f deploy/docker/Dockerfile`, which is confusing now that there are two Dockerfiles; it would be clearer to update the example commands to show how to build/run using this specific Dockerfile and to distinguish it from `deploy/docker/Dockerfile`.

## Individual Comments

### Comment 1
<location path="Dockerfile" line_range="1-2" />
<code_context>
+# docker build -t hgjazhgj/alas:latest -f deploy/docker/Dockerfile .
+# docker run -v ${PWD}:/app/AzurPilot -p 25548:25548 --name AzurPilot -it --rm hgjazhgj/alas
+
</code_context>
<issue_to_address>
**suggestion:** The build command in the root Dockerfile comment points to the deploy Dockerfile, which is confusing.

Since this Dockerfile is at the repo root, the example build command using `-f deploy/docker/Dockerfile` is ambiguous about which Dockerfile should be used. Please either update the example to reference this file (e.g. `-f Dockerfile`) or explicitly document that this is an alternative to `deploy/docker/Dockerfile` with its own build command.

```suggestion
# Example build using this root Dockerfile:
# docker build -t hgjazhgj/alas:latest -f Dockerfile .
#
# Alternatively, build using the deploy Dockerfile:
# docker build -t hgjazhgj/alas:latest -f deploy/docker/Dockerfile .
#
# Example run:
# docker run -v ${PWD}:/app/AzurPilot -p 25548:25548 --name AzurPilot -it --rm hgjazhgj/alas
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread Dockerfile
Comment on lines +1 to +2
# docker build -t hgjazhgj/alas:latest -f deploy/docker/Dockerfile .
# docker run -v ${PWD}:/app/AzurPilot -p 25548:25548 --name AzurPilot -it --rm hgjazhgj/alas

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

suggestion: 根目录 Dockerfile 注释中的构建命令指向了 deploy 目录下的 Dockerfile,这会让人困惑。

由于这个 Dockerfile 位于代码库根目录,示例中使用 -f deploy/docker/Dockerfile 的构建命令会让人搞不清到底应该使用哪个 Dockerfile。请考虑将示例更新为引用当前这个文件(例如使用 -f Dockerfile),或者明确说明这是 deploy/docker/Dockerfile 的一个替代方案,并为其单独提供构建命令说明。

Suggested change
# docker build -t hgjazhgj/alas:latest -f deploy/docker/Dockerfile .
# docker run -v ${PWD}:/app/AzurPilot -p 25548:25548 --name AzurPilot -it --rm hgjazhgj/alas
# Example build using this root Dockerfile:
# docker build -t hgjazhgj/alas:latest -f Dockerfile .
#
# Alternatively, build using the deploy Dockerfile:
# docker build -t hgjazhgj/alas:latest -f deploy/docker/Dockerfile .
#
# Example run:
# docker run -v ${PWD}:/app/AzurPilot -p 25548:25548 --name AzurPilot -it --rm hgjazhgj/alas
Original comment in English

suggestion: The build command in the root Dockerfile comment points to the deploy Dockerfile, which is confusing.

Since this Dockerfile is at the repo root, the example build command using -f deploy/docker/Dockerfile is ambiguous about which Dockerfile should be used. Please either update the example to reference this file (e.g. -f Dockerfile) or explicitly document that this is an alternative to deploy/docker/Dockerfile with its own build command.

Suggested change
# docker build -t hgjazhgj/alas:latest -f deploy/docker/Dockerfile .
# docker run -v ${PWD}:/app/AzurPilot -p 25548:25548 --name AzurPilot -it --rm hgjazhgj/alas
# Example build using this root Dockerfile:
# docker build -t hgjazhgj/alas:latest -f Dockerfile .
#
# Alternatively, build using the deploy Dockerfile:
# docker build -t hgjazhgj/alas:latest -f deploy/docker/Dockerfile .
#
# Example run:
# docker run -v ${PWD}:/app/AzurPilot -p 25548:25548 --name AzurPilot -it --rm hgjazhgj/alas

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant