Skip to content

Commit f13e873

Browse files
committed
docker: Improve driver container image size
Copy only the necessary ko files and firmware binaries to minimize final driver container image size. See #33 for more details. Signed-off-by: Hersh Pathak hersh.pathak@intel.com
1 parent 53f000c commit f13e873

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

docker/intel-dgpu-driver.Dockerfile

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ FROM ${DTK_AUTO} as builder
1515
ARG PMT_RELEASE
1616
ARG I915_RELEASE
1717
ARG FIRMWARE_RELEASE
18+
ARG KERNEL_FULL_VERSION
1819

1920
WORKDIR /build
2021

@@ -37,10 +38,17 @@ RUN git clone -b ${I915_RELEASE} --single-branch https://github.com/intel-gpu/in
3738
&& cp defconfigs/drm .config \
3839
&& make olddefconfig && make -j $(nproc) && make modules_install
3940

41+
# Create /build/modules directory with all *.ko and *.ko.xz files
42+
RUN mkdir -p /build/modules \
43+
&& find /lib/modules/${KERNEL_FULL_VERSION}/ \
44+
-name "*.ko" -o -name "*.ko.xz" -o -name "modules.order" -o -name "modules.builtin" -type f \
45+
| xargs -I {} install -D {} /build/modules/
46+
4047
# Firmware
4148
RUN git clone -b ${FIRMWARE_RELEASE} --single-branch https://github.com/intel-gpu/intel-gpu-firmware.git \
4249
&& install -D /build/intel-gpu-firmware/COPYRIGHT /licenses/firmware/COPYRIGHT \
43-
&& install -D /build/intel-gpu-firmware/COPYRIGHT /build/intel-gpu-firmware/firmware/license/COPYRIGHT
50+
&& install -D /build/intel-gpu-firmware/COPYRIGHT /build/firmware/license/COPYRIGHT \
51+
&& install -D /build/intel-gpu-firmware/firmware/dg2* /build/firmware/
4452

4553
FROM registry.redhat.io/ubi8/ubi-minimal:latest
4654
ARG DRIVER_VERSION
@@ -63,7 +71,7 @@ RUN microdnf update -y && rm -rf /var/cache/yum
6371
RUN microdnf -y install kmod findutils && microdnf clean all
6472
COPY --from=builder /licenses/ /licenses/
6573
COPY --from=builder /etc/driver-toolkit-release.json /etc/
66-
COPY --from=builder /lib/modules/${KERNEL_FULL_VERSION}/ /opt/lib/modules/${KERNEL_FULL_VERSION}/
67-
COPY --from=builder /build/intel-gpu-firmware/firmware/ /firmware/i915/
74+
COPY --from=builder /build/modules/ /opt/lib/modules/${KERNEL_FULL_VERSION}/
75+
COPY --from=builder /build/firmware/ /firmware/i915/
6876

69-
RUN depmod -b /opt ${KERNEL_FULL_VERSION}
77+
RUN depmod -b /opt ${KERNEL_FULL_VERSION}

0 commit comments

Comments
 (0)