|
1 | | -FROM docker.io/library/rust:latest as builder |
2 | | -RUN wget https://apt.llvm.org/llvm-snapshot.gpg.key && \ |
3 | | - apt-key add llvm-snapshot.gpg.key && \ |
4 | | - rm -f llvm-snapshot.gpg.key && \ |
5 | | - echo "deb http://apt.llvm.org/bullseye/ llvm-toolchain-bullseye-13 main" > /etc/apt/sources.list.d/llvm.list && \ |
6 | | - apt update && \ |
7 | | - apt upgrade -y --no-install-recommends && \ |
8 | | - apt install -y --no-install-recommends \ |
9 | | - clang-13 \ |
10 | | - libelf-dev \ |
11 | | - gcc-multilib \ |
12 | | - lld-13 \ |
13 | | - lldb-13 \ |
14 | | - python3-pip \ |
15 | | - sudo && \ |
16 | | - apt purge --auto-remove && \ |
17 | | - apt clean && \ |
18 | | - rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* |
19 | | -# Build libbpf and bpftool from the newest stable kernel sources. |
20 | | -RUN curl -Lso linux.tar.xz \ |
21 | | - $(curl -s https://www.kernel.org/ | grep -A1 "latest_link" | grep -Eo '(http|https)://[^"]+') && \ |
22 | | - tar -xf linux.tar.xz && \ |
23 | | - cd $(find . -maxdepth 1 -type d -name "linux*") && \ |
24 | | - cd tools/lib/bpf && \ |
25 | | - make -j $(nproc) && \ |
26 | | - make install prefix=/usr && \ |
27 | | - cd ../../bpf/bpftool && \ |
28 | | - make -j $(nproc) && \ |
29 | | - make install prefix=/usr && \ |
30 | | - cd ../../../.. && \ |
31 | | - rm -rf linux* |
32 | | -RUN cargo install libbpf-cargo |
| 1 | +FROM registry.opensuse.org/opensuse/leap:15.3 as builder |
| 2 | +RUN zypper ar -p 90 -r https://download.opensuse.org/repositories/devel:/languages:/rust/openSUSE_Leap_15.3/devel:languages:rust.repo \ |
| 3 | + && zypper ar -p 90 -r https://download.opensuse.org/repositories/devel:/tools:/compiler/openSUSE_Leap_15.3/devel:tools:compiler.repo \ |
| 4 | + && zypper --gpg-auto-import-keys ref \ |
| 5 | + && zypper --non-interactive dup --allow-vendor-change |
| 6 | +RUN zypper --non-interactive install -t pattern \ |
| 7 | + devel_C_C++ \ |
| 8 | + devel_basis \ |
| 9 | + && zypper --non-interactive install \ |
| 10 | + clang \ |
| 11 | + curl \ |
| 12 | + libelf-devel \ |
| 13 | + libopenssl-devel \ |
| 14 | + llvm \ |
| 15 | + rustup \ |
| 16 | + sudo \ |
| 17 | + tar \ |
| 18 | + xz \ |
| 19 | + zlib-devel \ |
| 20 | + && zypper clean |
| 21 | +RUN rustup-init -y |
| 22 | +ENV PATH="/root/.cargo/bin:${PATH}" |
33 | 23 | RUN rustup component add \ |
34 | 24 | clippy \ |
35 | 25 | rustfmt |
| 26 | +RUN cargo install \ |
| 27 | + libbpf-cargo |
36 | 28 |
|
37 | 29 | FROM builder AS build |
| 30 | +WORKDIR /usr/local/src |
| 31 | +# Build bpftool from the newest stable kernel sources. |
| 32 | +RUN curl -Lso linux.tar.xz \ |
| 33 | + $(curl -s https://www.kernel.org/ | grep -A1 "latest_link" | grep -Eo '(http|https)://[^"]+') \ |
| 34 | + && tar -xf linux.tar.xz \ |
| 35 | + && mv $(find . -maxdepth 1 -type d -name "linux*") linux \ |
| 36 | + && cd linux \ |
| 37 | + && cd tools/bpf/bpftool \ |
| 38 | + && make -j $(nproc) |
| 39 | +# Prepare lockc sources and build it. |
38 | 40 | WORKDIR /usr/local/src/lockc |
39 | 41 | COPY . ./ |
40 | | -ENV CLANG /usr/bin/clang-13 |
41 | 42 | RUN cargo build |
42 | 43 |
|
43 | | -FROM registry.opensuse.org/opensuse/leap-microdnf:15.3 AS lockcd |
| 44 | +FROM registry.opensuse.org/opensuse/leap:15.3 AS lockcd |
44 | 45 | # runc links those libraries dynamically |
45 | | -RUN microdnf install -y --nodocs \ |
| 46 | +RUN zypper --non-interactive install \ |
46 | 47 | libseccomp2 \ |
47 | 48 | libselinux1 \ |
48 | | - && microdnf clean all |
49 | | -ARG PROFILE=debug |
| 49 | + && zypper clean |
| 50 | +COPY --from=build /usr/local/src/linux/tools/bpf/bpftool/bpftool /usr/sbin/bpftool |
50 | 51 | COPY --from=build /usr/local/src/lockc/target/$PROFILE/lockcd /usr/bin/lockcd |
51 | 52 | ENTRYPOINT ["/usr/bin/lockcd"] |
0 commit comments