bash
fucker@ubuntu ~ % cat Dockerfile
FROM ubuntu:22.04
ENV DEBIAN_FRONTEND=noninteractive
ENV FORCE_UNSAFE_CONFIGURE=1
RUN apt update && apt install -y \
build-essential git wget curl \
python3 python3-pip python3-dev python3-setuptools python3-distutils \
swig \
bison flex bc gawk \
device-tree-compiler \
libssl-dev \
zlib1g-dev \
unzip rsync file \
ncurses-dev \
xz-utils \
automake autoconf libtool gettext \
ccache \
&& rm -rf /var/lib/apt/lists/*
# 克隆 OpenWrt 官方源码
RUN git clone https://github.com/openwrt/openwrt --depth=1 /openwrt
WORKDIR /openwrt
CMD ["/bin/bash"]
构建docker images
bash
docker build --platform=linux/arm64 -t openwrt-mt7981 .
编译openwrt,把编译后的img映射到本地
fucker@ubuntu /tmp % mkdir openwrt
fucker@ubuntu /tmp % docker run --rm -it --name openwrt-build \
-v /tmp/openwrt:/openwrt/bin \
mt7981 \
bash
注意:
(1) 我以为dockerimages 要装x64的,但是不需要。arm64可以交叉编译x86 的