[LTP] [RFC PATCH] Add simple Alpine container

Richard Palethorpe rpalethorpe@suse.com
Tue Sep 26 11:01:01 CEST 2023


Can be built with `docker/podman build .`. Then run with `podman -it
run sh`. It contains Kirk in /opt/kirk. So `cd /opt/kirk && ./kirk -f
ltp --run-suite syscalls` will run some tests.
---

Hello,

This builds and installs the LTP and Kirk inside an Alpine
container. The idea is to use a standard container workflow to build
and run the LTP from source. This helps with testing LTP itself and
running tests inside a container.

I'd like to add some container files to upstream to help with various
workflows.

The container has a number of problems:

1. If the Git directory has build artifacts in it, these are copied
   into the container (.dockerignore may help)
2. The resulting container is quite large (possibly due to debug symbols)
3. Where should we put container files and how should we name them?
4. Making the slightest change results in a complete container rebuild

Note that SUSE publishes a TW container based on our packaging system:
https://build.opensuse.org/project/show/benchmark:ltp:devel
https://registry.opensuse.org/cgi-bin/cooverview?srch_term=project%3D%5Ebenchmark+container%3D.*

Also, for developing tests, it may be better to build the LTP outside
of a container then copy in the files.

Latest tree is here:
https://github.com/richiejp/ltp/tree/alpine-container

 Containerfile | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
 create mode 100644 Containerfile

diff --git a/Containerfile b/Containerfile
new file mode 100644
index 000000000..7bd50ce52
--- /dev/null
+++ b/Containerfile
@@ -0,0 +1,35 @@
+FROM alpine:3.18 AS build
+ARG LTPROOT=/opt/ltp
+
+RUN mkdir /build
+WORKDIR /build
+COPY . /build
+RUN ./ci/alpine.sh
+RUN ./build.sh -p $LTPROOT -i
+
+FROM alpine:3.18
+ARG LTPROOT=/opt/ltp
+ARG KIRKROOT=/opt/kirk
+
+RUN apk add \
+            acl \
+            keyutils \
+            libaio \
+            libacl \
+            libcap \
+            libselinux \
+            libsepol \
+            libtirpc \
+            numactl \
+            openssl \
+            py3-msgpack
+
+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
+
+RUN adduser -D -g "Unprivileged LTP user" ltp
+RUN su ltp
-- 
2.40.1



More information about the ltp mailing list