35 lines
952 B
Docker
Executable File
35 lines
952 B
Docker
Executable File
FROM ubuntu:latest
|
|
|
|
# 使用阿里云源
|
|
RUN sed -i 's/ports.ubuntu.com/mirrors.aliyun.com/g' /etc/apt/sources.list && \
|
|
sed -i 's/archive.ubuntu.com/mirrors.aliyun.com/g' /etc/apt/sources.list && \
|
|
sed -i 's/security.ubuntu.com/mirrors.aliyun.com/g' /etc/apt/sources.list
|
|
|
|
# 安装必要的依赖
|
|
RUN apt-get update && apt-get install -y \
|
|
git \
|
|
wget \
|
|
unzip \
|
|
xz-utils \
|
|
zip \
|
|
libglu1-mesa \
|
|
curl \
|
|
sudo \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# 创建非root用户
|
|
RUN useradd -ms /bin/bash flutter_user
|
|
RUN adduser flutter_user sudo
|
|
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
|
|
|
|
# 克隆Flutter并设置权限
|
|
RUN git clone https://github.com/flutter/flutter.git /flutter && \
|
|
chown -R flutter_user:flutter_user /flutter
|
|
|
|
# 设置环境变量
|
|
ENV PATH="/flutter/bin:${PATH}"
|
|
|
|
# 切换用户并配置Flutter
|
|
USER flutter_user
|
|
WORKDIR /home/flutter_user
|
|
RUN flutter config --enable-windows-desktop |