openwrt-builders/generic/Containerfile

60 lines
1.3 KiB
Plaintext
Raw Normal View History

2023-11-28 08:54:28 +00:00
FROM localhost/openwrt-base:debian-23.05.2 AS builder
2023-10-11 07:30:38 +00:00
2023-10-11 12:58:21 +00:00
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}"
2023-10-11 07:30:38 +00:00
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
2023-11-28 08:54:28 +00:00
ADD files/ files/
2023-10-11 07:30:38 +00:00
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/ /