mirror of
				https://github.com/linuxkit/linuxkit.git
				synced 2025-10-31 02:13:29 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			66 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Docker
		
	
	
	
	
	
			
		
		
	
	
			66 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			Docker
		
	
	
	
	
	
| ARG IMAGE
 | |
| FROM ${IMAGE} AS ksrc
 | |
| FROM linuxkit/alpine:518c2ed0f398c5508969ac5e033607201fb419ed AS build
 | |
| RUN apk add \
 | |
|     attr-dev \
 | |
|     autoconf \
 | |
|     automake \
 | |
|     build-base \
 | |
|     file \
 | |
|     git \
 | |
|     libtirpc-dev \
 | |
|     libtool \
 | |
|     mpc1-dev \
 | |
|     mpfr-dev \
 | |
|     util-linux-dev \
 | |
|     zlib-dev
 | |
| 
 | |
| COPY --from=ksrc /kernel-dev.tar /
 | |
| RUN tar xf kernel-dev.tar
 | |
| 
 | |
| # Also extract the kernel modules
 | |
| COPY --from=ksrc /kernel.tar /
 | |
| RUN tar xf kernel.tar
 | |
| 
 | |
| # Note: ZFS and SPL commits must match. It's unclear how much the user
 | |
| # space tools must match the kernel module version.
 | |
| # package on Alpine is 0.6.5.9. We pick the version that compiles with
 | |
| # latest kernel we support.
 | |
| ENV VERSION=0.7.12
 | |
| 
 | |
| ENV SPL_REPO=https://github.com/zfsonlinux/spl.git
 | |
| ENV SPL_COMMIT=spl-${VERSION}
 | |
| RUN git clone ${SPL_REPO} && \
 | |
|     cd spl && \
 | |
|     git checkout ${SPL_COMMIT}
 | |
| 
 | |
| ENV ZFS_REPO=https://github.com/zfsonlinux/zfs.git
 | |
| ENV ZFS_COMMIT=zfs-${VERSION}
 | |
| RUN git clone ${ZFS_REPO} && \
 | |
|     cd zfs && \
 | |
|     git checkout ${ZFS_COMMIT}
 | |
| 
 | |
| WORKDIR /spl
 | |
| RUN ./autogen.sh && \
 | |
|     ./configure && \
 | |
|     cd module && \
 | |
|     make && \
 | |
|     make install
 | |
| 
 | |
| WORKDIR /zfs
 | |
| RUN ./autogen.sh && \
 | |
|     ./configure --with-spl=/spl && \
 | |
|     cd module && \
 | |
|     make -j "$(getconf _NPROCESSORS_ONLN)" && \
 | |
|     make install
 | |
| 
 | |
| # Run depmod against the new module directory.
 | |
| RUN cd /lib/modules && \
 | |
|     depmod -ae * 
 | |
| 
 | |
| FROM scratch
 | |
| ENTRYPOINT []
 | |
| CMD []
 | |
| WORKDIR /
 | |
| COPY --from=build /lib/modules/ /lib/modules/
 |