60 lines
1.3 KiB
Docker
60 lines
1.3 KiB
Docker
FROM localhost/openwrt-base:debian-23.05.2 AS builder
|
|
|
|
ARG PLATFORM=x86
|
|
ARG SUBTARGET=64
|
|
ARG DEVICE=generic
|
|
|
|
RUN printf '%s\n%s\n%s\n' \
|
|
"CONFIG_TARGET_${PLATFORM}=y" \
|
|
"CONFIG_TARGET_${PLATFORM}_${SUBTARGET}=y" \
|
|
"CONFIG_TARGET_${PLATFORM}_${SUBTARGET}_DEVICE_${DEVICE}=y" \
|
|
> /run/target.config
|
|
|
|
RUN echo "Building for ${PLATFORM}/${SUBTARGET}/${DEVICE}"
|
|
|
|
RUN cat /run/target.config > .config
|
|
RUN make defconfig
|
|
|
|
RUN make -j$(nproc) V=w download
|
|
|
|
RUN --mount=type=cache,dst=/root/.ccache make -j$(nproc) \
|
|
V=w \
|
|
CONFIG_CCACHE=y \
|
|
CONFIG_CCACHE_DIR=/root/.ccache \
|
|
tools/compile
|
|
|
|
RUN --mount=type=cache,dst=/root/.ccache make -j$(nproc) \
|
|
V=w \
|
|
CONFIG_CCACHE=y \
|
|
CONFIG_CCACHE_DIR=/root/.ccache \
|
|
toolchain/compile
|
|
|
|
ADD config /run/config
|
|
ADD files/ files/
|
|
RUN cat /run/target.config /run/config >> .config
|
|
RUN make defconfig
|
|
|
|
RUN --mount=type=cache,dst=/root/.ccache make -j$(nproc) \
|
|
V=wc \
|
|
CONFIG_CCACHE=y \
|
|
CONFIG_CCACHE_DIR=/root/.ccache \
|
|
target/compile
|
|
|
|
RUN --mount=type=cache,dst=/root/.ccache make -j$(nproc) \
|
|
V=wc \
|
|
CONFIG_CCACHE=y \
|
|
CONFIG_CCACHE_DIR=/root/.ccache \
|
|
package/compile
|
|
|
|
RUN --mount=type=cache,dst=/root/.ccache make -j$(nproc) \
|
|
V=wc \
|
|
CONFIG_CCACHE=y \
|
|
CONFIG_CCACHE_DIR=/root/.ccache \
|
|
world
|
|
|
|
RUN --mount=type=cache,dst=/root/.ccache ccache -s
|
|
|
|
FROM scratch
|
|
|
|
COPY --from=builder /root/OpenWRT/bin/ /
|