From 732dc030efe1a60eb94f8efeebe8b2edf2986df6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=91=E5=BE=AE?= <1067852565@qq.com> Date: Fri, 24 Mar 2023 11:47:44 +0000 Subject: [PATCH] update dockerfile and README --- README.md | 42 +++++++++++++++++++++++++----------------- dockerfile | 15 ++++----------- 2 files changed, 29 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index e5e7111..b29874c 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,8 @@ Dockerfile, and GitHub action, along with all necessary dependencies to simplify Also, this is a minimal libbpf-rs project, you can read the code to understand how to write ebpf programs using libbpf-rs. + + ## **Getting Started** To get started, simply click the "Use this template" button on the GitHub repository page. This will create @@ -20,24 +22,9 @@ a new repository in your account with the same files and structure as this templ Run the following code and you will enter a docker environment with all the basic development dependencies and tools. ```sh -docker build -t any:any . -docker run -it any:any -# or use our image docker run -it ghcr.io/eunomia-bpf/libbpf-rs-template:latest ``` -### Build and Run - -Assuming you have installed the required dependencies or are in a docker environment, -the following command will compile the sample ebpf application. - -```sh -make -./target/release/runqslower -# or use cargo directly -cargo run -``` - ## **Features** This starter template includes the following features: @@ -65,8 +52,19 @@ git clone https://github.com/your_username/your_new_repository.git ### **3. Install dependencies** -For dependencies, it varies from distribution to distribution. -You can refer to dockerfile for installation. +For dependencies, it varies from distribution to distribution. You can refer to dockerfile for installation. + +On Ubuntu, you may run `make install` or + +```sh +sudo apt-get install -y --no-install-recommends \ + libelf1 libelf-dev zlib1g-dev \ + make clang llvm +``` + +to install dependencies. + +Use `wget -nv -O - https://sh.rustup.rs | sh -s -- -y` to install rust toolchain. ### **4. Build the project** @@ -78,6 +76,16 @@ make build This will compile your code and create the necessary binaries. +### **5. Run the project** + +the following command will run the sample ebpf application. + +```sh +./target/release/runqslower +# or use cargo directly +cargo run +``` + ### **7. GitHub Actions** This template includes two GitHub actions: diff --git a/dockerfile b/dockerfile index cf3fcf6..c892def 100644 --- a/dockerfile +++ b/dockerfile @@ -3,15 +3,8 @@ FROM ubuntu:22.04 WORKDIR /root/ COPY . /root/ -RUN apt-get update -y && \ - apt-get install -y --no-install-recommends \ - wget pkg-config build-essential zlib1g-dev clang llvm libelf1 libelf-dev && \ - apt-get install -y --no-install-recommends ca-certificates && \ - update-ca-certificates && \ - apt-get clean && \ - rm -rf /var/lib/apt/lists/* +RUN apt-get update \ + && apt-get install -y --no-install-recommends libelf1 \ + && rm -rf /var/lib/apt/lists/* -RUN wget -nv -O - https://sh.rustup.rs | sh -s -- -y -ENV PATH="/root/.cargo/bin:${PATH}" - -ENTRYPOINT ["/bin/bash"] +ENTRYPOINT ["/root/target/release/runqslower"]