diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000000..bbcd7072f06d --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +Containerfile diff --git a/Containerfile b/Containerfile new file mode 100644 index 000000000000..2f8192c3b27c --- /dev/null +++ b/Containerfile @@ -0,0 +1,32 @@ +ARG PREFIX=docker.io/ +ARG DISTRO_NAME=alpine +ARG DISTRO_RELEASE=3.18 + +FROM $PREFIX$DISTRO_NAME:$DISTRO_RELEASE AS build +ARG LTPROOT=/opt/ltp +ARG DISTRO_NAME=alpine +ARG DISTRO_RELEASE=3.18 + +RUN mkdir /build +WORKDIR /build +COPY . /build +RUN ./ci/${DISTRO_NAME}.sh +RUN git clean -fdX +RUN ./build.sh -p $LTPROOT -i + +FROM $PREFIX$DISTRO_NAME:$DISTRO_RELEASE +ARG LTPROOT=/opt/ltp +ARG KIRKROOT=/opt/kirk +ARG DISTRO_NAME=alpine + +COPY --from=build /build/ci/${DISTRO_NAME}-runtime.sh $LTPROOT/runtime-deps.sh +RUN $LTPROOT/runtime-deps.sh + +COPY --from=build $LTPROOT $LTPROOT +ENV LTPROOT=$LTPROOT +ENV PATH=$LTPROOT/testcases/bin:$LTPROOT/bin:$PATH + +RUN mkdir -p $KIRKROOT +COPY --from=build /build/tools/kirk $KIRKROOT + +USER ltp diff --git a/ci/alpine-runtime.sh b/ci/alpine-runtime.sh new file mode 100755 index 000000000000..e4941f329200 --- /dev/null +++ b/ci/alpine-runtime.sh @@ -0,0 +1,16 @@ +#!/bin/sh -eux + +apk add \ + acl \ + keyutils \ + libaio \ + libacl \ + libcap \ + libselinux \ + libsepol \ + libtirpc \ + numactl \ + openssl \ + py3-msgpack + +adduser -D -g "Unprivileged LTP user" ltp diff --git a/ci/tumbleweed-runtime.sh b/ci/tumbleweed-runtime.sh new file mode 100755 index 000000000000..5207988e7708 --- /dev/null +++ b/ci/tumbleweed-runtime.sh @@ -0,0 +1,13 @@ +#!/bin/sh -eux + +zyp="zypper --non-interactive install --force-resolution --no-recommends" + +$zyp \ + iproute2 \ + keyutils \ + libaio1 \ + libmnl0 \ + libnuma1 \ + libtirpc3 + +useradd ltp