簡體   English   中英

如何從 docker 容器中使用 flutter-pi 運行應用程序

[英]how to run an app with flutter-pi from a docker container

我在樹莓派 4 上運行一個 flutter 應用程序,我正在使用flutter-pi 一切正常,但我想更上一層樓。

我想將應用程序和所有 flutter-pi 依賴項封裝在一個 docker 容器中。

我使用ubuntu:jammy圖像作為基礎,我已經根據flutter-pi安裝了所有依賴項。

當我運行該應用程序時,出現此錯誤:

[locales] Warning: The system has no configured locale. The default "C" locale may or may not be supported by the app.
[keyboard] Could not load keyboard configuration from "/etc/default/keyboard". Default keyboard config will be used. load_file: No such file or directory
[flutter-pi] Could not query DRM device list: No such file or directory

注意:樹莓派被配置為進行控制台自動登錄並且沒有圖形界面

我開發了一個 flutter-pi 應用程序並將其封裝在一個容器中。

我注意到這個錯誤(Could not query DRM device list: No such file or directory)只是有時發生在我身上,配置總是相同的,但有時我遇到了它,有時我沒有。

我假設它與運行 docker 容器的主機系統有關,因為正如我之前所說,容器的配置在工作容器和非工作容器中始終相同。

我在我的 dockerfile 的配置下面附加下來(它由 2 個 dockerfile 組成,但它只是我正在運行的一個容器,第二個 dockerfile 使用第一個內置在 emotionsrl/tower-display-base 中的容器)。

display_launcher.py 僅在經過一些與其余部分無關的檢查后才運行 flutter ( flutter-pi --release./spotlink_build )。

FROM ubuntu

RUN apt -y update \
    && apt -y install git \
    && apt -y install wget \
    && apt -y install build-essential

WORKDIR /TOWER_DISPLAY

# STEP 1 DIPENDENZE
RUN git clone --depth 1 \
    https://github.com/ardera/flutter-engine-binaries-for-arm.git \
    engine-binaries && cd engine-binaries && ./install.sh

# STEP 2 DIPENDENZE
ENV TZ=Europe/Rome
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt -y install cmake \
    libgl1-mesa-dev \
    libgles2-mesa-dev \
    libegl1-mesa-dev \
    libdrm-dev \
    libgbm-dev

RUN DEBIAN_FRONTEND='noninteractive' apt -y install ttf-mscorefonts-installer
RUN apt -y install fontconfig \
    libsystemd-dev \
    libinput-dev \
    libudev-dev \
    libxkbcommon-dev

#STEP 3 DIPENDENZE
RUN fc-cache
###########################
# COMPILING
RUN git clone https://github.com/ardera/flutter-pi
WORKDIR /TOWER_DISPLAY/flutter-pi/build
RUN cmake ..
RUN make -j `nproc`
RUN make install
FROM emotionsrl/tower-display-base

WORKDIR /TOWER_DISPLAY

COPY spotlink_build ./spotlink_build
COPY display_launcher.py ./display_launcher.py

CMD python3 ./display_launcher.py

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM