-
Notifications
You must be signed in to change notification settings - Fork 21
docker: Use openSUSE Leap as a base image for all stages #101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| .gitignore |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,51 +1,53 @@ | ||
| FROM docker.io/library/rust:latest as builder | ||
| RUN wget https://apt.llvm.org/llvm-snapshot.gpg.key && \ | ||
| apt-key add llvm-snapshot.gpg.key && \ | ||
| rm -f llvm-snapshot.gpg.key && \ | ||
| echo "deb http://apt.llvm.org/bullseye/ llvm-toolchain-bullseye-13 main" > /etc/apt/sources.list.d/llvm.list && \ | ||
| apt update && \ | ||
| apt upgrade -y --no-install-recommends && \ | ||
| apt install -y --no-install-recommends \ | ||
| clang-13 \ | ||
| libelf-dev \ | ||
| gcc-multilib \ | ||
| lld-13 \ | ||
| lldb-13 \ | ||
| python3-pip \ | ||
| sudo && \ | ||
| apt purge --auto-remove && \ | ||
| apt clean && \ | ||
| rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | ||
| # Build libbpf and 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 && \ | ||
| cd $(find . -maxdepth 1 -type d -name "linux*") && \ | ||
| cd tools/lib/bpf && \ | ||
| make -j $(nproc) && \ | ||
| make install prefix=/usr && \ | ||
| cd ../../bpf/bpftool && \ | ||
| make -j $(nproc) && \ | ||
| make install prefix=/usr && \ | ||
| cd ../../../.. && \ | ||
| rm -rf linux* | ||
| RUN cargo install libbpf-cargo | ||
| FROM registry.opensuse.org/opensuse/leap:15.3 as builder | ||
| RUN zypper ar -p 90 -r https://download.opensuse.org/repositories/devel:/languages:/rust/openSUSE_Leap_15.3/devel:languages:rust.repo \ | ||
| && zypper ar -p 90 -r https://download.opensuse.org/repositories/devel:/tools:/compiler/openSUSE_Leap_15.3/devel:tools:compiler.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 \ | ||
| curl \ | ||
| libelf-devel \ | ||
| libopenssl-devel \ | ||
| llvm \ | ||
| rustup \ | ||
| sudo \ | ||
| tar \ | ||
| xz \ | ||
| zlib-devel \ | ||
| && zypper clean | ||
| RUN rustup-init -y | ||
| ENV PATH="/root/.cargo/bin:${PATH}" | ||
| RUN rustup component add \ | ||
| clippy \ | ||
| rustfmt | ||
| RUN cargo install \ | ||
| libbpf-cargo | ||
|
|
||
| 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 . ./ | ||
| ENV CLANG /usr/bin/clang-13 | ||
| RUN cargo build | ||
|
|
||
| FROM registry.opensuse.org/opensuse/leap-microdnf:15.3 AS lockcd | ||
| FROM registry.opensuse.org/opensuse/leap:15.3 AS lockcd | ||
| # runc links those libraries dynamically | ||
| RUN microdnf install -y --nodocs \ | ||
| RUN zypper --non-interactive install \ | ||
| libseccomp2 \ | ||
| libselinux1 \ | ||
| && microdnf clean all | ||
| && zypper clean | ||
| ARG PROFILE=debug | ||
| COPY --from=build /usr/local/src/linux/tools/bpf/bpftool/bpftool /usr/sbin/bpftool | ||
| COPY --from=build /usr/local/src/lockc/target/$PROFILE/lockcd /usr/bin/lockcd | ||
| ENTRYPOINT ["/usr/bin/lockcd"] |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nickgerace I have an explanation for those
ifstatements now.So, this whole file is triggered by many events which are mutual exclusive when it comes to pushing images. We trigger this workflow on:
mainbranch (merging a PR) (github.refisrefs/heads/*)github.refisrefs/tags/*)github.refisrefs/pull/*)For all of those actions we want to build an image, but we want to push it differently. To handle then differently, we need to catch them with if statements.
That's why we do:
if: ${{ startsWith(github.ref, 'refs/pull/') }}if: ${{ startsWith(github.ref, 'refs/heads/') }}if: ${{ startsWith(github.ref, 'refs/tags/') }}There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the explanation!