Skip to content

Commit

Permalink
docker: Adjust Dockerfile to Aya
Browse files Browse the repository at this point in the history
After lockc-project#199 we don't have to use libbpf anymore. Since building stuff
with Rust locally is easy (and only rustup is required), it's also time
to get rid of dapper.

Signed-off-by: Michal Rostecki <[email protected]>
  • Loading branch information
vadorovsky committed May 15, 2022
1 parent d953e56 commit 9894ee1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 39 deletions.
34 changes: 7 additions & 27 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
FROM registry.opensuse.org/opensuse/leap:15.3 as builder
# zypper ar -p 90 -r https://download.opensuse.org/repositories/devel:/languages:/rust/openSUSE_Leap_15.3/devel:languages:rust.repo
RUN zypper ar -p 90 -r https://download.opensuse.org/repositories/devel:/tools:/compiler/openSUSE_Leap_15.3/devel:tools:compiler.repo \
RUN zypper ar -p 90 -r https://download.opensuse.org/repositories/devel:/languages:/rust/openSUSE_Leap_15.3/devel:languages:rust.repo \
&& zypper --gpg-auto-import-keys ref \
&& zypper --non-interactive dup --allow-vendor-change
RUN zypper --non-interactive install -t pattern \
devel_C_C++ \
devel_basis \
&& zypper --non-interactive install \
clang \
RUN zypper --non-interactive install \
curl \
libelf-devel \
libopenssl-devel \
llvm \
rustup \
sudo \
tar \
Expand All @@ -30,33 +24,19 @@ RUN cargo +nightly install \
cargo-udeps

FROM builder AS build
WORKDIR /usr/local/src
# Build bpftool from the newest stable kernel sources.
RUN curl -Lso linux.tar.xz \
$(curl -s https://www.kernel.org/ | grep -A1 "latest_link" | grep -Eo '(http|https)://[^"]+') \
&& tar -xf linux.tar.xz \
&& mv $(find . -maxdepth 1 -type d -name "linux*") linux \
&& cd linux \
&& cd tools/bpf/bpftool \
&& make -j $(nproc)
# Prepare lockc sources and build it.
WORKDIR /usr/local/src/lockc
COPY . ./
ARG profile=release
RUN --mount=type=cache,target=/.root/cargo/registry \
--mount=type=cache,target=/usr/local/src/lockc/target \
if [[ "$profile" == "debug" ]]; then cargo build; else cargo build --profile ${profile}; fi \
&& cp target/${profile}/lockcd /usr/local/bin/lockcd
cargo xtask build-ebpf --release \
&& cargo build --release \
&& cp target/release/lockc /usr/local/bin/lockc

FROM registry.opensuse.org/opensuse/leap:15.3 AS lockcd
# runc links those libraries dynamically
RUN zypper --non-interactive install \
libseccomp2 \
libselinux1 \
&& zypper clean
ARG profile=release
# Install rust-gdb and rust-lldb for debug profile
RUN if [[ "$profile" == "debug" ]]; then zypper --non-interactive install gdb lldb python3-lldb rust; fi
COPY --from=build /usr/local/src/linux/tools/bpf/bpftool/bpftool /usr/sbin/bpftool
COPY --from=build /usr/local/bin/lockcd /usr/bin/lockcd
ENTRYPOINT ["/usr/bin/lockcd"]
COPY --from=build /usr/local/bin/lockc /usr/bin/lockc
ENTRYPOINT ["/usr/bin/lockc"]
12 changes: 0 additions & 12 deletions Dockerfile.dapper

This file was deleted.

0 comments on commit 9894ee1

Please sign in to comment.