Init Repo
This commit is contained in:
+71
@@ -0,0 +1,71 @@
|
|||||||
|
FROM ubuntu:22.04
|
||||||
|
|
||||||
|
# Prevent interactive prompts during package installation
|
||||||
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
ENV LANG=C.UTF-8
|
||||||
|
|
||||||
|
# Install official OpenWrt build dependencies
|
||||||
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
|
build-essential \
|
||||||
|
ca-certificates \
|
||||||
|
clang \
|
||||||
|
cpio \
|
||||||
|
curl \
|
||||||
|
file \
|
||||||
|
gawk \
|
||||||
|
gettext \
|
||||||
|
git \
|
||||||
|
libelf-dev \
|
||||||
|
libglib2.0-dev \
|
||||||
|
libncurses5-dev \
|
||||||
|
libncursesw5-dev \
|
||||||
|
libssl-dev \
|
||||||
|
python3 \
|
||||||
|
python3-dev \
|
||||||
|
python3-pip \
|
||||||
|
python3-ply \
|
||||||
|
python3-pyelftools \
|
||||||
|
python3-setuptools \
|
||||||
|
rsync \
|
||||||
|
subversion \
|
||||||
|
swig \
|
||||||
|
time \
|
||||||
|
unzip \
|
||||||
|
wget \
|
||||||
|
zlib1g-dev \
|
||||||
|
sudo \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Create a non-root build user (OpenWrt requires building as non-root)
|
||||||
|
RUN useradd -m -s /bin/bash builduser && \
|
||||||
|
echo "builduser ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
|
||||||
|
|
||||||
|
USER builduser
|
||||||
|
WORKDIR /home/builduser
|
||||||
|
|
||||||
|
# Clone target OpenWrt release (change branch as needed)
|
||||||
|
ARG OPENWRT_BRANCH=openwrt-25.12
|
||||||
|
RUN git clone --depth 1 -b ${OPENWRT_BRANCH} https://git.openwrt.org/openwrt/openwrt.git openwrt
|
||||||
|
|
||||||
|
WORKDIR /home/builduser/openwrt
|
||||||
|
|
||||||
|
RUN echo "src-git ha_cluster https://github.com/pgaufillet/openwrt-ha-feed.git" >> feeds.conf.default
|
||||||
|
|
||||||
|
# Update and install default package feeds
|
||||||
|
RUN ./scripts/feeds update -a && \
|
||||||
|
./scripts/feeds install -a
|
||||||
|
|
||||||
|
RUN echo "CONFIG_TARGET_x86=y" > .config && \
|
||||||
|
echo "CONFIG_TARGET_x86_64=y" >> .config && \
|
||||||
|
echo "CONFIG_PACKAGE_dnsmasq-ha=y" >> .config && \
|
||||||
|
echo "CONFIG_PACKAGE_lease-sync=y" >> .config && \
|
||||||
|
echo "CONFIG_PACKAGE_owsync=y" >> .config && \
|
||||||
|
echo "CONFIG_PACKAGE_ha-cluster=y" >> .config && \
|
||||||
|
echo "CONFIG_PACKAGE_luci-app-ha-cluster=y" >> .config && \
|
||||||
|
sed -i 's/CONFIG_PACKAGE_dnsmasq=y/# CONFIG_PACKAGE_dnsmasq is not set/' .config && \
|
||||||
|
make defconfig
|
||||||
|
|
||||||
|
RUN make -j$(nproc) download
|
||||||
|
RUN make -j$(nproc) V=s
|
||||||
|
|
||||||
|
CMD ["/bin/bash"]
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
Setup:
|
||||||
|
|
||||||
|
mkdir -p bin dl
|
||||||
|
touch .config
|
||||||
|
|
||||||
|
chown -R 1000:1000 bin dl .config
|
||||||
|
|
||||||
|
docker compose up -d
|
||||||
|
|
||||||
|
|
||||||
|
Making changes:
|
||||||
|
|
||||||
|
Configure OpenWrt:
|
||||||
|
docker compose exec -it openwrt-builder make menuconfig
|
||||||
|
Download target source files:
|
||||||
|
docker compose exec -it openwrt-builder make -j$(nproc) download
|
||||||
|
Compile firmware:
|
||||||
|
docker compose exec -it openwrt-builder make -j$(nproc) V=s
|
||||||
|
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
version: '3.8'
|
||||||
|
|
||||||
|
services:
|
||||||
|
openwrt-build:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
container_name: openwrt-build
|
||||||
|
# image: openwrt-build:latest
|
||||||
|
user: "1000:1000"
|
||||||
|
tty: true
|
||||||
|
stdin_open: true
|
||||||
|
volumes:
|
||||||
|
# Firmware outputs mapped directly to host filesystem
|
||||||
|
- ./bin:/home/builduser/openwrt/bin
|
||||||
|
# Source tarballs cached on host to avoid re-downloading across builds
|
||||||
|
- ./dl:/home/builduser/openwrt/dl
|
||||||
|
# Persistent build configuration file (.config)
|
||||||
|
- ./.config:/home/builduser/openwrt/.config
|
||||||
|
# Named volumes for heavy build artifacts (maximizes I/O performance)
|
||||||
|
- openwrt-build-dir:/home/builduser/openwrt/build_dir
|
||||||
|
- openwrt-staging-dir:/home/builduser/openwrt/staging_dir
|
||||||
|
- openwrt-ccache:/home/builduser/.ccache
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
openwrt-build-dir:
|
||||||
|
openwrt-staging-dir:
|
||||||
|
openwrt-ccache:
|
||||||
Reference in New Issue
Block a user