omnAPP/Dockerfile.windows-cross
2025-09-23 16:23:15 +08:00

54 lines
1.2 KiB
Docker
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

FROM ubuntu:22.04
# 设置环境变量
ENV DEBIAN_FRONTEND=noninteractive
ENV FLUTTER_VERSION=3.24.0
ENV FLUTTER_HOME=/flutter
ENV PATH=$PATH:$FLUTTER_HOME/bin
# 安装必要的依赖
RUN apt-get update && apt-get install -y \
curl \
git \
unzip \
xz-utils \
zip \
libglu1-mesa \
cmake \
ninja-build \
pkg-config \
libgtk-3-dev \
liblzma-dev \
libstdc++-12-dev \
mingw-w64 \
gcc-mingw-w64 \
g++-mingw-w64 \
wine \
wine64 \
&& rm -rf /var/lib/apt/lists/*
# 下载并安装Flutter
RUN cd /tmp && curl -O https://mirrors-i.tuna.tsinghua.edu.cn/flutter/flutter_infra_release/releases/stable/linux/flutter_linux_${FLUTTER_VERSION}-stable.tar.xz \
&& tar xf flutter_linux_${FLUTTER_VERSION}-stable.tar.xz \
&& rm -rf /flutter \
&& mv flutter /flutter \
&& rm flutter_linux_${FLUTTER_VERSION}-stable.tar.xz
# 预下载Flutter依赖
RUN flutter precache
# 修复Git权限问题
RUN git config --global --add safe.directory /flutter
# 设置工作目录
WORKDIR /app
# 复制项目文件
COPY . .
# 获取依赖
RUN flutter pub get
# 尝试构建Windows版本使用交叉编译
CMD ["flutter", "build", "windows", "--release"]