mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-22 02:21:34 +00:00
At least for the perf image I got an error when not having the ARG up front. Signed-off-by: Rolf Neugebauer <rn@rneugeba.io>
50 lines
914 B
Docker
50 lines
914 B
Docker
# This Dockerfile extracts the source code and headers from a kernel package,
|
|
# builds the perf utility, and places it into a scratch image
|
|
ARG IMAGE
|
|
ARG BUILD_IMAGE
|
|
|
|
FROM ${IMAGE} AS ksrc
|
|
|
|
FROM ${BUILD_IMAGE} AS build
|
|
RUN apk add \
|
|
argp-standalone \
|
|
bash \
|
|
bc \
|
|
binutils-dev \
|
|
bison \
|
|
build-base \
|
|
diffutils \
|
|
flex \
|
|
gmp-dev \
|
|
installkernel \
|
|
kmod \
|
|
elfutils-dev \
|
|
findutils \
|
|
libelf-static \
|
|
mpc1-dev \
|
|
mpfr-dev \
|
|
python3 \
|
|
sed \
|
|
tar \
|
|
xz \
|
|
xz-dev \
|
|
zlib-dev \
|
|
zlib-static
|
|
|
|
COPY --from=ksrc /linux.tar.xz /kernel-headers.tar /
|
|
RUN tar xf linux.tar.xz && \
|
|
tar xf kernel-headers.tar
|
|
|
|
WORKDIR /linux
|
|
|
|
RUN mkdir -p /out && \
|
|
make -C tools/perf LDFLAGS=-static V=1 && \
|
|
strip tools/perf/perf && \
|
|
cp tools/perf/perf /out
|
|
|
|
FROM scratch
|
|
ENTRYPOINT []
|
|
CMD []
|
|
WORKDIR /
|
|
COPY --from=build /out/perf /usr/bin/perf
|